使用<select>的onchange()事件
解决方案 »
- 如何实现在一个页面内存储数据另一个页面读取数据,不是传参,页面也都是静态HTML的
- 求解一个javascript效果
- 关于事件绑定的一些问题,谢谢!
- 求编辑器的解决办法
- netmeeting嵌入到网页后如何通过代码实现原netmeeting中“自动接收呼叫”功能?
- 请教高手一个关于去除页面元素的问题,在线等!
- JAVASCRIPT赋值时遇到的多行文本问题.
- 如何隐藏路径?
- 怎样将<form>提交页面指向showModalDialog打开的窗口中?
- 跪求 JS 代码 转换 C# 代码 很小一段~~~
- (?<= ) 零宽度正回顾后发断言。仅当子表达式在此位置的左侧匹配时才继续匹配。问题!(?<= )似乎在js中无效?
- 请问 鼠标单击时的虚框有办法取消吗??
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加表格行</title>
</head>
<script language="javascript">
function addRow()
{//给表格加一行
var tab = document.getElementById("tab");
thisTr = tab.insertRow(-1);
thisCell = thisTr.insertCell(-1);
thisCell.innerHTML = " ";
}
</script>
<body>
<select onchange="addRow()">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<table width="200" border="1" cellspacing="0" cellpadding="0" id="tab">
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加表格行</title>
</head>
<script language="javascript">
tempArray=new Object();
function addRow(obj)
{//给表格加一行
if(!tempArray[obj.options[obj.selectedIndex].text]){
var tab = document.getElementById("tab");
thisTr = tab.insertRow(-1);
thisCell = thisTr.insertCell(-1);
thisCell.innerHTML = " ";
tempArray[obj.options[obj.selectedIndex].text]="1"
}
}
</script>
<body>
<select onchange="addRow(this)">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<table width="200" border="1" cellspacing="0" cellpadding="0" id="tab">
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加表格行</title>
</head>
<script language="javascript">
var op=new Array();
function addRow(obj)
{//给表格加一行
if(op[obj.options[obj.selectedIndex].index]!='added')
{
var tab = document.getElementById("tab");
thisTr = tab.insertRow(-1);
thisCell = thisTr.insertCell (-1);
thisCell.innerHTML = " ";
op[obj.options[obj.selectedIndex].index] = 'added';
}
}
</script>
<body>
<select onchange="addRow(this);">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<table width="200" border="1" cellspacing="0" cellpadding="0" id="tab">
<tr>
<td> </td>
</tr>
</table>
</body>
</html> -.-|\