首页 > 代码库 > JavaScript加法

JavaScript加法

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head></head><body>    <h1>我的第一段 JavaScript</h1>    <p>JavaScript 能够对事件作出反应。比如对按钮的点击:</p>    <p id="demo">JavaScript change HTMLelement Content</p>    <script type="text/javascript">        function box() {            alert(aaa);        }        function myFunction() {            x = document.getElementById("demo"); // 找到元素            x.innerHTML = "Hello JavaScript改变内容!"; // 改变内容            alert(aaa);        }        function myadd() 
{
var x =parseInt( document.getElementById(‘a‘).value)
            var y = Number(document.getElementById(‘b‘).value)
           
            document.getElementById(‘c‘).value=http://www.mamicode.com/x+y;
} function mysub(a, b) { a
+ b; } function changeImage() { element = document.getElementById(myimage) if (element.src.match("pic1")) { element.src = "file:///C:/Users/Administrator/Pictures/img/b.bmp"; } else { element.src = "file:///C:/Users/Administrator/Pictures/img/pic1.png" } } </script> <input id="a"> <div style="HEIGHT: 19px; WIDTH: 22px; POSITION: relative; DISPLAY: inline" ms_positioning="FlowLayout">+</div> <input id="b"> <input type="button" value=http://www.mamicode.com/"=合计" onclick="myadd()"> <input id="c"> <img id="myimage" onclick="changeImage()" src="file:///C:/Users/Administrator/Pictures/img/pic1.png"></body></html>

 

JavaScript加法