In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to use javascript to find a difference". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to use javascript to find a difference"!
Javascript to achieve the difference method: 1, to create a HTML sample file; 2, to create an input input box; 3, through the "num1-num2" formula to calculate the difference of numbers in input, and then put into the div.
This article operating environment: windows7 system, javascript1.8.5 version, DELL G3 computer
How does javascript find the difference?
JavaScript calculates the difference between the two numbers:
Demand
Enter two numbers in the two input boxes, and when the button is clicked, the difference between the two numbers is calculated and displayed in the div with id as result.
Implementation code
Body {padding-top: 100px; text-align: center;} # result {width: 50%; height: 100px; margin: 0 auto; border: 1px solid # ccc } calculate / / get the value in input, and then get the minus Put the result in div / / input.value div [XSS _ clean] event binding / / find the object input button div var oIpt1 = document.getElementById ("ipt1") var oIpt2 = document.getElementById ("ipt2") var oBtn = document.getElementById ("btn") var oBox = document.getElementById ("result") / / event function binding oBtn.onclick = function () {/ / calculate the number difference in input and put it in div var num1 = oIpt1 .value var num2 = oIpt2.value var result = num1-num2 / / set a content for div result oBox [XSS _ clean] = result} so far I believe you have a deeper understanding of "how to use javascript to find the difference". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.