html 使用button调用函数
生活随笔
收集整理的這篇文章主要介紹了
html 使用button调用函数
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<html>
<head><title>網頁標題 </title>
</head>
<body><script type="text/javascript">function Calc() {var x = parseInt(document.getElementById("Text1").value);var y = parseInt(document.getElementById("Text2").value);var resultValue = Math.pow(x, y);document.getElementById("Text3").value = resultValue;}</script><input type="text" size="10" id="Text1" value="0" />的<input type="text" size="10" id="Text2" value="2" />次方等于<input type="text" size="20" id="Text3" value="0" /><input type="button" value="計算" οnclick="Calc()" />
</body>
</html>
?
總結: 1.js和html的交互:? html中定義空間的ID? ?然后js獲取ID
轉載于:https://www.cnblogs.com/sun-shadow/p/8299859.html
總結
以上是生活随笔為你收集整理的html 使用button调用函数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java-多线程安全-锁
- 下一篇: postman 变量