- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
JS表格选项制作概要1
1 option 集合可返回包含 select 元素中所有 option 的一个数组。
注释:数组中的每个元素对应一个 option 标签 - 由 0 起始。
语法
selectObject.options[]
说明
options[] 集合并非一个普通的 HTMLcollection。为了和早期的浏览器向后兼容,这个集合有某种特殊的行为:允许通过 Select 对象来改变显示的选项:
如果把 options.length 属性设置为 0,Select 对象中所有选项都会被清除。
如果 options.length 属性的值比当前值小,出现在数组尾部的元素就会被丢弃。
如果把 options[] 数组中的一个元素设置为 null,那么选项就会从 Select 对象中删除。
可以通过构造函数 Option() 来创建一个新的 option 对象(需要设置 options.length 属性)。
实例
下面的例子可输出下拉列表中所有选项的文本:
html
head
script type=text/javascript
function getOptions()
{
var x=document.getElementById(mySelect);
for (i=0;ix.length;i++)
{
document.write(x.options[i].text)
document.write(br /)
}
}
/script
/head
body
form
Select your favorite fruit:
select id=mySelect
optionApple/option
optionOrange/option
optionPineapple/option
optionBanana/option
/select
br /br /
input type=button onclick=getOptions()
value=Output all options
/form
/body
/html
2 outerheight 属性是一个只读的整数,声明了整个窗口的高度。
语法
window.outerheight=pixels
提示和注释
提示:IE 不支持此属性,且没有提供替代的属性。
实例
下面的例子可把新窗口设置为 100x100 像素:
html
body
script type=text/javascript
myWindow=window.open(,)
myWindow.outerheight=100
myWindow.outerwidth=100
myWindow.document.write(This is myWindow)
myWindow.focus()
/script
/body
/html
3 outerwidth 属性是一个只读的整数,声明了整个窗口的宽度。
语法
window.outerwidth=pixels
提示和注释
提示:IE 不支持此属性,且没有提供替代的属性。
实例
下面的例子可把新窗口设置为 100x100 像素:
html
body
script type=text/javascript
myWindow=window.open(,)
myWindow.outerheight=100
myWindow.outerwidth=100
myWindow.document.write(This is myWindow)
myWindow.focus()
/script
/body
/html
4 outlineColor 属性设置元素周围的轮廓的颜色。
语法:
Object.style.outlineColor=color-name|color-rgb|color-hex
实例
本例改变轮廓的颜色:
html
head
style type=text/css
p
{
border: thin solid #00FF00;
outline: thick solid #FF0000;
}
/style
script type=text/javascript
function changeOutlineColor()
{
document.getElementById(p1).style.outlineColor=#00FF00;
}
/script
/head
body
input type=button onclick=changeOutlineColor()
value=Change outline color /
p id=p1This is a paragraph/p
/body
/html
5 outl
文档评论(0)