js动态加载下拉框里的值
来源:互联网 发布:如何做网络优化 编辑:程序博客网 时间:2024/06/06 16:07
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script type="text/javascript">
function bbb()
{
var s1 = document.getElementById("Select2");
var o = s1.getAttribute("value");
var cbo = document.getElementById("select1");
for(var i=0;i<cbo.options.length;i++)
{
cbo.options.remove(i);
}
if(o=="1")
{
var o1 = document.createElement("option");
o1.innerHTML = "abc";
o1.setAttribute("value","1");
var o2 = document.createElement("option");
o2.innerHTML = "abc1";
o2.setAttribute("value","3");
var o3 = document.createElement("option");
o3.innerHTML = "abc2";
o3.setAttribute("value","2");
var s2 = document.getElementById("select1");
s2.appendChild(o1);
s2.appendChild(o2);
s2.appendChild(o3);
}
else
{
cbo.options.remove(0);
}
}
</script>
<body onload="bbb();">
<form id="form1" name="form1" method="post" action="">
<label>
<select name="select" id="select1">
</select>
</label> <input type="button" value="asd" onclick="bbb();" style="width: 57px" />
<select id="Select2" onchange="bbb();" name="D1">
<option value="1">A</option>
<option value="2">B</option>
</select></form>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script type="text/javascript">
function bbb()
{
var s1 = document.getElementById("Select2");
var o = s1.getAttribute("value");
var cbo = document.getElementById("select1");
for(var i=0;i<cbo.options.length;i++)
{
cbo.options.remove(i);
}
if(o=="1")
{
var o1 = document.createElement("option");
o1.innerHTML = "abc";
o1.setAttribute("value","1");
var o2 = document.createElement("option");
o2.innerHTML = "abc1";
o2.setAttribute("value","3");
var o3 = document.createElement("option");
o3.innerHTML = "abc2";
o3.setAttribute("value","2");
var s2 = document.getElementById("select1");
s2.appendChild(o1);
s2.appendChild(o2);
s2.appendChild(o3);
}
else
{
cbo.options.remove(0);
}
}
</script>
<body onload="bbb();">
<form id="form1" name="form1" method="post" action="">
<label>
<select name="select" id="select1">
</select>
</label> <input type="button" value="asd" onclick="bbb();" style="width: 57px" />
<select id="Select2" onchange="bbb();" name="D1">
<option value="1">A</option>
<option value="2">B</option>
</select></form>
</body>
</html>
- js动态加载下拉框里的值
- 动态加载下拉框里的值
- JS 动态加载下拉框
- bootstrap里bootstrap动态加载下拉框
- js下拉框动态加载数据信息
- 将js里的一个数组里面的值动态地添加到一个下拉框中
- 改变下拉框动态加载文本框的值
- 弹框中动态加载下拉框,下拉框的定位问题
- JS实现页面下拉动态加载
- JS实现下拉框的动态添加
- 在网页里动态加载js
- 在网页里动态加载 js
- 通过ajax动态加载select控件【下拉框】的option
- JS动态添加下拉框
- 如何创建Html下拉框和js及jsp如何获取下拉框里的内容
- window form 下拉菜单的动态加载
- json输出分类(js动态填充下拉框的选项)
- js对下拉框(select)的动态操作
- 学习摘编
- 如何学习
- 扎克伯格:我们如何接管世界
- 我是新手啊,多指教
- Matlab与C#混合编程
- js动态加载下拉框里的值
- 命令总结
- 用户 'IIS APPPOOL/test' 登录失败[解决办法]
- JQuery实现的三级联动菜单
- tomcat
- math对象
- 网络与传输等高层即传统协议
- 存储转发
- 复用