Demo
Code
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#txt1").keyup(function(){
if(this.value!="")
$(this).closest('td').next().text(parseInt($("#txt1").val())*parseInt($("#td1").text()));
else
$(this).closest('td').next().text("");
});
});
</script>
</head>
<body>
<table>
<tr>
<td id="td1">2 X </td>
<td><input type="text" id="txt1">=</td>
<td></td>
</tr>
</table>
</body>
</html>
2 X | = |
Code
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#txt1").keyup(function(){
if(this.value!="")
$(this).closest('td').next().text(parseInt($("#txt1").val())*parseInt($("#td1").text()));
else
$(this).closest('td').next().text("");
});
});
</script>
</head>
<body>
<table>
<tr>
<td id="td1">2 X </td>
<td><input type="text" id="txt1">=</td>
<td></td>
</tr>
</table>
</body>
</html>
Comments
Post a Comment