在同一个页面上有两个table
第一个table里面有一个
<td>价格</td>
<td>
<input class="inputtext" name="price" onkeydown="fooatonly(this);">
</td>
下面的table:
<td>价格</td>
<td>``````</td>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
要在上面的<td>里面输入数字的时候在下面的<td>里面要显示出来·····求高手····
第一个table里面有一个
<td>价格</td>
<td>
<input class="inputtext" name="price" onkeydown="fooatonly(this);">
</td>
下面的table:
<td>价格</td>
<td>``````</td>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
要在上面的<td>里面输入数字的时候在下面的<td>里面要显示出来·····求高手····
<td>价格</td>
<td><span id="span_price"></span></td>事件修改onkeydown=》onkeyup,即onkeyup="fooatonly(this);"JS
function fooatonly(obj)
{
var price=$(obj).val();
$("#span_price").text(price);
}
}
$(document).ready(function () {
var txtone = $("input[class*=inputtext]");
txtone.keyup(function () {
var price=txtone.val();
$("#dierge_price").text(price);});
});
<head>
<title>aaaa</title>
<script type="text/javascript">
function gg(){
document.getElementById("td1").innerText=document.getElementById("price").value;
}
</script>
</head>
<body>
1231312332131
<table>
<tr>
<td>aaa</td>
<td>
<input class="inputtext" id="price" name="price" onkeyup="gg();">
</td>
<td>bbb</td>
<td id="td1"></td>
</tr>
</table>
</body>
</html>再加一个onkeyup呗
他那是用了jquery,你引用jquery文件了么。 没用的话,看看我的,不用jquery也行啊
<input class="inputtext" name="price" onkeydown="fooatonly(this); onkeyup="gg();">
可是在另外一个<input>里面,按照上面的方法,我输入的是字母和汉字却会报错····