87,921
社区成员
发帖
与我相关
我的任务
分享
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input onclick="textValue()" type="button" value="12" name="bt1" />
<input onclick="textValue()" type="button" value="22" name="bt2" />
<input onclick="textValue()" type="button" value="32" name="bt3" />
<input onclick="textValue()" type="button" value="42" name="bt4" />
<table id="message">
<tr>
<td> <input name="a1" size="3" type="text" class="input" /> </td>
<td> <input name="a2" size="3" type="text" class="input" /> </td>
<td> <input name="a3" size="3" type="text" class="input" /> </td>
<td> <input name="a4" size="3" type="text" class="input" /> </td>
</tr>
</table>
</div>
</form>
</body>
</html>
<script language="JavaScript" type="text/javascript">
<!--
function textValue(){
var v = new Array();
for(var i = 1; i <= 4; i++)
{
v[i]=document.getElementById("bt"+i).value;
document.getElementById("a"+i).value = v[i] ;
}
}
//-->
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input onclick="textValue(this)" type="button" value="12" id="0" />
<input onclick="textValue(this)" type="button" value="22" id="1" />
<input onclick="textValue(this)" type="button" value="32" id="2" />
<input onclick="textValue(this)" type="button" value="42" id="3" />
<table id="message">
<tr>
<td> <input id="a1" size="3" type="text" class="input" value="" /> </td>
<td> <input id="a2" size="3" type="text" class="input" value=""/> </td>
<td> <input id="a3" size="3" type="text" class="input" value=""/> </td>
<td> <input id="a4" size="3" type="text" class="input" value=""/> </td>
</tr>
</table>
</div>
</form>
</body>
</html>
<script language="JavaScript" type="text/javascript">
<!--
function textValue(oInput){
document.getElementById('message').rows[0].cells[oInput.id].childNodes[0].value = oInput.value;
}
//-->
</script>