使用<select>的onchange()事件
解决方案 »
- ajax 同步
- extjs中new Ext.Window有一个autoLoad页面提交问题,求帮忙
- sjg:gridColumn 属性设置问题
- 获取服务器端时间倒计时脚本
- 请问我有两个视频怎么让他们一起播放
- 自定义对话框的问题
- 请教replace方法的初级问题...
- 谁有javascript的对象结构图呀,我想下载下来打印一下
- 关于自写滚动条和鼠标滚轮
- <input type="text"><a herf="xx.jsp?tt=" onclick="">go</a>当单击了go之后,如何取得文本框的值假设为value,并将其赋给右边的连接,使
- (?<= ) 零宽度正回顾后发断言。仅当子表达式在此位置的左侧匹配时才继续匹配。问题!(?<= )似乎在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> -.-|\