pangjie
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="js/jquery-1.4.2.js" type="text/javascript"></script>
    <script type="text/javascript">
        //加法计算器。两个文本框中输入数字,点击【=】按钮将相加的结果放到第三个
        //文本框中。attr(“”),val()
        $(function () {
            $("#btneq").click(function () {
                var txt1 = $("#txt1").val();
                var txt2 = $("#txt2").val();
                $("#txt3").val(parseInt(txt1, 10) + parseInt(txt2));
            });
        })
    </script>
</head>
<body>
    <input type="text" id="txt1" />
    +
    <input type="text" id="txt2" />
    <input type="button" value="=" id="btneq" />
    <input type="text" id="txt3" />
</body>
</html>

 

分类:

技术点:

相关文章:

  • 2021-09-07
  • 2021-08-29
  • 2021-11-01
  • 2021-09-28
  • 2021-09-28
  • 2022-12-23
  • 2021-10-16
  • 2021-09-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2021-06-13
  • 2021-09-28
  • 2021-09-28
相关资源
相似解决方案