首 页
网络学院
视频教程
资源下载
HOT
实例教程
图文教程
专题中心
学习社区
繁體中文
当前位置:
首页
>
图文教程
>
网络编程
>
Javascript
> js select 控制实现代码
Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document
No.
«
‹
70
71
72
73
›
»
技术文章搜索
关键字
Javascript 中的 js select 控制实现代码
出处:
互联网
整理:
软晨网(RuanChen.com)
发布:
2009-09-12
浏览: 230 ::
收藏到网摘: n/a
javaScript 读取和设置文档元素的样式属性
javascript 类方法定义还是有点区别
用js控制select的一些比较不错的功能。 实现代码:
复制代码
代码如下:
<select id=test11 size=5 style="width:50px"></select>
<select id="test" style="width:50px"></select>
<button onclick='test[test.length]=new Option("1","12");'>同时添加text和value</button>
<button onclick='test.insertBefore(document.createElement("option")).innerText="2";'>对text操作</button> <button onclick='test.appendChild(document.createElement("option")).setAttribute("value","3");'>对value操作</button>
<button onclick="alert(test.outerHTML)">view</button>
<button onclick="test.removeChild(test.children[0])">del1</button>
<button onclick="test.firstChild.removeNode()">del2</button>
<button onclick="test[0]=null">del3</button>
效果演示:
点击运行可以看到效果:
同时添加text和value
对text操作
对value操作
view
del1
del2
del3
[Ctrl+A 全选 提示:你可先修改部分代码,再按运行]
javaScript 读取和设置文档元素的样式属性
javascript 类方法定义还是有点区别
评论 (0)
All
登陆
还没注册?