副问题[/!--empirenews.page--]
document 文挡工具 - JavaScript剧本说话描写 ——————————————————————— 注:页面上元素name属性和JavaScript引用的名称必需同等包罗巨细写 不然会提醒你一个错误信息 “引用的元素为空可能不是工具\” ———————————————————————
工具属性 document.title //配置文档问题等价于HTML的title标签 document.bgColor //配置页面配景致 document.fgColor //配置远景致(文本颜色) document.linkColor //未点击过的链接颜色 document.alinkColor //激活链接(核心在此链接上)的颜色 document.vlinkColor //已点击过的链接颜色 document.URL //配置URL属性从而在统一窗口打开另一网页 document.fileCreatedDate //文件成立日期,只读属性 document.fileModifiedDate //文件修他日期,只读属性 document.fileSize //文件巨细,只读属性 document.cookie //配置和读出cookie document.charset //配置字符集 简体中文:gb2312 ——————————————————————— 常用工具要领 document.write() //动态向页面写入内容 document.createElement(Tag) //建设一个html标签工具 document.getElementById(ID) //得到指定ID值的工具 document.getElementsByName(Name) //得到指定Name值的工具 document.body.appendChild(oTag) ——————————————————————— body-主体子工具 document.body //指定文档主体的开始和竣事等价于body>/body> document.body.bgColor //配置或获取工具后头的配景颜色 document.body.link //未点击过的链接颜色 document.body.alink //激活链接(核心在此链接上)的颜色 document.body.vlink //已点击过的链接颜色 document.body.text //文本色 document.body.innerText //配置body>…/body>之间的文本 document.body.innerHTML //配置body>…/body>之间的HTML代码 document.body.topMargin //页面上边距 document.body.leftMargin //页面左边距 document.body.rightMargin //页面右边距 document.body.bottomMargin //页面下边距 document.body.background //配景图片
document.body.appendChild(oTag) //动态天生一个HTML工具
常用工具变乱 document.body.onclick=”func()” //鼠标指针单击工具是触发 document.body.onmouseover=”func()” //鼠标指针移到工具时触发 document.body.onmouseout=”func()” //鼠标指针移出工具时触发 ——————————————————————— location-位置子工具
document.location.hash // #号后的部门 document.location.host // 域名+端标语 document.location.hostname // 域名 document.location.href // 完备URL document.location.pathname // 目次部门 document.location.port // 端标语 document.location.protocol // 收集协议(http:) document.location.search // ?号后的部门
documeny.location.reload() //革新网页 document.location.reload(URL) //打开新的网页 document.location.assign(URL) //打开新的网页 document.location.replace(URL) //打开新的网页 ——————————————————————— selection-选区子工具 document.selection ———————————————————————
images荟萃(页面中的图象)
a)通过荟萃引用 document.images //对应页面上的img标签 document.images.length //对应页面上img标签的个数 document.images[0] //第1个img标签 document.images[i] //第i-1个img标签
b)通过nane属性直接引用 img name=”oImage” document.images.oImage //document.images.name属性
c)引用图片的src属性 document.images.oImage.src //document.images.name属性.src
d)建设一个图象 var oImage oImage = new Image() document.images.oImage.src=”1.jpg” 同时在页面上成立一个img /标签与之对应就可以表现
———————————————————————-
forms荟萃(页面中的表单)
a)通过荟萃引用 document.forms //对应页面上的form标签 document.forms.length //对应页面上/formform标签的个数 document.forms[0] //第1个/formform标签 document.forms[i] //第i-1个/formform标签 document.forms[i].length //第i-1个/formform中的控件数 document.forms[i].elements[j] //第i-1个/formform中第j-1个控件
b)通过标签name属性直接引用 /formform name=”Myform”>input name=”myctrl”/>/form document.Myform.myctrl //document.表单名.控件名
(编辑:湖南网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|