如何编写在两个文本框中添加两个数字并在Web应用程序的第三个文本框中打印结果的脚本? [英] How to write the Script for adding two numbers in two text boxes and print the Result on the 3rd text box on web Application ?

查看:100
本文介绍了如何编写在两个文本框中添加两个数字并在Web应用程序的第三个文本框中打印结果的脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写在两个文本框中添加两个数字并在Web应用程序的第三个文本框中打印结果的脚本?

请帮助我,先生....!

How to write the Script for adding two numbers in two text boxes and print the Result on the 3rd text box on web Application ?

pls help me sir....!

推荐答案

假设脚本的意思是Javascript:
Assuming by script you mean Javascript:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=windows-1250">
    <meta name="generator" content="PSPad editor, www.pspad.com">
    <title></title>
    <SCRIPT language = JavaScript>

      function calculate() {
        A = eval(no1.value)
        B = eval(no2.value)
        C = (A + B)
        result.value = C
        }

    </SCRIPT>
  </head>
  <body>
    First Number : <input type="text" name="no1" /><br />
    Second Number: <input type="text" name="no2" /><br />
    Resulting num: <input type="text" name="result" /><br />
    <Input Type = Button name = b1 value = "Add Numbers" onClick = calculate()>
  </body>
</html>


这篇关于如何编写在两个文本框中添加两个数字并在Web应用程序的第三个文本框中打印结果的脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆