javascript按钮和文本框 [英] javascript button and textboxes

查看:94
本文介绍了javascript按钮和文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个文本框。



我将计算两个文本框输入的值然后当我点击一个按钮时,计算出的值将显示在第3个文本框。



有谁能告诉我怎么做?

I have two textboxes.

I will calculate the values of two text box inputs then when I click on a button, then the calculated value will be shown on the 3rd text box.

Can anyone please tell me how to do that?

推荐答案

下面是JS功能,但SA说这是非常基本的。请在使用本论坛之前进行谷歌搜索。





Below is the JS function but as SA said this is pretty basic. Please do a google search before using this forum.


<script>


document )。ready( function (){
(document).ready(function() {


#CalculateButton)。click(功能(){

var result = document .getElementById( textbox1)。value + document .getElementById( textbox2)。value;
document .getElementById( textbox3)。value = result ;
}

});

});
< / script>
("#CalculateButton").click(function(){ var result = document.getElementById("textbox1").value + document.getElementById("textbox2").value; document.getElementById("textbox3").value= result; } }); }); </script>


这篇关于javascript按钮和文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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