首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

jQuery 对输入框值开展计算

2012-10-09 
jQuery 对输入框值进行计算!DOCTYPE html html headstylep { color:blue margin:8px }/style

jQuery 对输入框值进行计算

<!DOCTYPE html> <html> <head>   <style>   p { color:blue; margin:8px; }   </style>   <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body>   <input type="text" id="s1" value=""/> * <input type="text" id="s2" value=""/> =  <input type="text" id="s3" value=""/>  <script> var value1=0;var value2=0;$("#s1").keyup(function(){value1 = $(this).val(); $("#s3").val(value2*value1); });$("#s2").keyup(function(){value2 = $(this).val(); $("#s3").val(value2*value1); });</script>  </body> </html>

?

热点排行