zoukankan      html  css  js  c++  java
  • 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=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="=合计" onclick="myadd()"> <input id="c"> <img id="myimage" onclick="changeImage()" src="file:///C:/Users/Administrator/Pictures/img/pic1.png"> </body> </html>
  • 相关阅读:
    C# switch-case
    Python学习日记之中文支持
    C++学习笔记(一)之指针
    python CGI 编程实践
    linux 配置 python3 CGI
    PowerShell入门简介
    资源整合,总有你想要的
    python 爬虫之 urllib库
    一天学一个Linux命令:第一天 ls
    DG磁盘分区提示错误
  • 原文地址:https://www.cnblogs.com/cb168/p/4080756.html
Copyright © 2011-2022 走看看