<select onchange="window.location.href='test.asp?id=' + this.value;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
解决方案 »
- 关于表格背景色的问题
- 请高手解释一下(function(){})是什么意思?要具体点的
- 知道 梅花雪 的qq喽~~~~~~~~~~~~~~~~~~~~~~
- WIN2003系统下的JS代码问题
- location.href得到url,如何判断url的页面名称含有index,如
- 如何验证复选框?只要有一个或者是一个以上的选项被选中,表单提交,如果选项均未被选中,则不提交
- 请问这个用document.writeln 怎么输出?
- 一个form里,如何点击不同按钮,执行不同的action?
- 怎样判断一个页面是否离开以前访问的IP地址而到达另一个IP地址页面,并在离开前发送一个命令到服务器?
- 如何实现这种转换?
- 100分!咨询all.item在IE和FF区别的问题!在线等待!
- innerHTML的深入用法
<head>
<title></title>
<script>
function showtable()
{
//window.location.href='Default.aspx?'
var newselect=document.getElementById("se");
var newtable=document.getElementById("t1").insertRow(-1);
var checkvalue=newselect.value;
for(var i=0;i<newselect.length;i++)
{
var newtr=document.createElement("tr");
var newtd=document.createElement("td");
newtd.innerHTML=newselect[i].value;
newtable.appendChild(newtr);
newtr.appendChild(newtd);
}
}
</script>
</head>
<body>
<form action="#">
<select id="se" onchange="showtable()">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<table id="t1" border=1>
<tr>
</tr>
</table>
</form>
</body>
</html> 是这个意思吗
<html>
<head>
<title></title>
<script>
function showtable()
{
delTable();//调用方法
//window.location.href='Default.aspx?'
var newtable=document.getElementById("t1").insertRow(-1);
var newselect=document.getElementById("se");
var checkvalue=newselect.value;
var newtr=document.createElement("tr");
var newtd=document.createElement("td");
newtd.innerHTML=checkvalue;
newtable.appendChild(newtr);
newtr.appendChild(newtd);
for(var i=0;i<newselect.length;i++)
{
if(newselect[i].value==checkvalue)
{
}else
{
newtr=document.createElement("tr");
newtd=document.createElement("td");
newtd.innerHTML=newselect[i].value;
newtable.appendChild(newtr);
newtr.appendChild(newtd);
}
}
}
//清楚表格
function delTable()
{
var testTable = document.getElementById("t1");
while(testTable.hasChildNodes()){
testTable.removeChild(testTable.lastChild);
}
}
</script>
</head>
<body>
<form action="#">
<select id="se" onchange="showtable()">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<table id="t1" border=1>
<tr>
</tr>
</table>
</form>
</body>
</html>
发到我的qq邮箱[email protected]