บทความนี้อธิบายวิธีการใช้งานของเครื่องคิดเลข JS Simple แบ่งปันสำหรับการอ้างอิงของคุณ วิธีการใช้งานเฉพาะมีดังนี้:
การคัดลอกรหัสมีดังนี้:
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title> </title>
<script type = "text/javascript">
ฟังก์ชั่นผลรวม () {
// JS Type Conversion ParseInt (ค่า, 10) หมายถึงการแปลงค่าของค่าเป็นค่าทศนิยม
var id1 = parseInt (document.getElementById ("BNT1") ค่า 10);
var id2 = parseInt (document.getElementById ("BNT2") ค่า 10);
var id3 = id1 + id2;
document.getElementById ("bnt3"). value = id3;
-
</script>
</head>
<body>
<input type = "text" id = "bnt1" />+<อินพุต type = "text" id = "bnt2" /> <อินพุต type = "ปุ่ม" value = "=" onclick = "sum ()" /> <อินพุต type = "text" readonly = "readonly" id = "bnt3"
</body>
</html>
ฉันหวังว่าบทความนี้จะเป็นประโยชน์กับการเขียนโปรแกรม JavaScript ของทุกคน