dom积累

本文详细介绍了DOM(文档对象模型)的基本概念及其在网页开发中的应用,包括如何使用JavaScript进行事件处理、动态设置事件及获取和修改元素内容等。此外还讲解了window对象的常用方法与属性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

dom  document object model 文档对象模型

1、事件  body 事件   onload onunload onbeforeunload  常见事件   onclick(单击)、ondblclick(双击)、onkeydown(按键按下)、onkeypress(点击按键)、onkeyup(按键释放)、onmousedown(鼠标按下)、onmousemove(鼠标移动)、onmouseout(鼠标离开元素范围)、onmouseover(鼠标移动到元素范围)、onmouseup(鼠标按键释放

2、动态设置事件  类似于net中注册事件  document.ondbclick = f1; //让document.ondbclick的事件处理函数为f1 3、window对象 window.document.body  当前浏览器窗口  方法   alert()   confirm("确定?")   navigate("http://www.baidu.com");   var timerId = setInterval("alert('hello')",500);   clearInterval(timerId)   setTimeout()   clearTimeout()   showModalDialog("window.htm") 模态窗体   showModelessDialog("window.htm")非模态窗体  属性   window.location.href   window.location.reload() 刷新页面   window.event    altKey    ctrlKey    shiftKey    returnValue 取消后续内容的执行    srcElement 引发事件的事件源    keyCode  引发事件时的键值    button  引发事件时的鼠标键1为左键,2为右键,3为左右键同时   screen  分辨率    width    height   clipboardData  粘贴板    getData("Text")    setData("Text",val)    clearData("Text")   history    back() go(-1)    forward() go(1)   document    方法     write()     writeln()     getElementById()     getElementsByName()     getElementsByTagName()     createElement()     appendChild() 4、获取元素内容  value   innerText  innerHTML 5、动态修改元素样式  this.style.backgroundColor  this.style.fontSize  this.style.marginTop  this.style.display = "none"隐藏  ""显示  this.style.width = "18px"

6、form对象  事件   onsubmit  方法   submit()

 

转载于:https://www.cnblogs.com/msdncrazy/archive/2013/03/21/2974432.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值