zoukankan      html  css  js  c++  java
  • 网易云课堂--妙味 《js基础课程》

    ==小例子1

     

    ==JS中允许将"." 替换成 “[ ]”

    document.getElementById('btn1') 写成 document['etElementById']('btn1')

    ==25 26 27课 

      

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>菜鸟教程(runoob.com)</title>
    <script>
    function myfun(){
    try{
    var e=document.getElementById("demo2").value;
        if(e=="") throw "值为空了";
        if(isNaN(e)) throw "非数字";
        if(e>10) throw "大于10了";
    }
        catch(err){
    var y= document.getElementById    ("mess2");
             y.innerHTML ="错误:" + err + "。";
        }
    }    
        </script>
    </head>
    <body>
    <h1>我的第一个查询</h1>
        <p>请输出一个 5 到 10 之间的数字:</p>
        <input id ="demo2" type="text">
        <button type="button" onclick="myfun()">请输入数字</button>
    <p id="mess2"></p>
    </body>
    </html>

    菜鸟教程在线工具
    http://www.runoob.com/try/try.php?filename=tryjs_throw_error

  • 相关阅读:
    问题 B: 投简历
    问题 C: P4 游戏中的Human角色
    绘制直方图
    绘制条形图
    绘制散点图
    问题 A: E2 驾驭const
    问题 B: 矩形类中运算符重载【C++】
    extjs tips
    extjs
    struts1
  • 原文地址:https://www.cnblogs.com/rogge7/p/6479610.html
Copyright © 2011-2022 走看看