• javascript 一些基础


    一些纯代码

    <html>
    <head>
    <title>学习Javascript</title>
    <script type="text/javascript">
    var clors=["red","green","blue"];
    //alert(clors.toString());//输出“red,green,blue”
    //alert(clors.valueOf());//输出“red,green,blue”
    //alert(clors.toLocaleString());//输出“red,green,blue”
    document.write(clors.join("|"));//输出“red|green|blue”
    var sClors="red,green,blue";
    var aClors=sClors.split(",");
    document.write(typeof aClors);
    document.write(aClors[0]);
    var aClor=aClors[0].split("");
    document.write("<br>"+aClor.toString());//输出r,e,d

    clors.sort();//排序
    document.write("<br/>"+clors.toString());

    var date1=new Date();
    document.write("<br/>"+date1.toDateString());

    eval("alert('hi')");

    eval("function sayHi(){alert('hi');}");
    sayHi();

    function showColor(){
    alert(this.color);
    }
    var oCar1=new Object;
    oCar1.color="red";
    oCar1.showColor=showColor;
    oCar1.showColor();

    //定义工厂函数
    function createCar(){
    var oTempCar=new Object;
    oTempCar.color="blue";
    oTempCar.doors=4;
    oTempCar.mpg=23;
    oTempCar.showColor=function(){
    alert(this.color);
    }//改成oTempCar.showColor=showColor;
    return oTempCar;
    }
    var oCar1=createCar();
    oCar1.showColor();

    function sayHelloWorld()
    {
    alert("Hello World!");
    }
    setTimout(sayHelloWorld,10000);
    </script>
    </head>
    <body>
    <a href="javascript:goSomewhere(1,2,3,4)" onmouseover="window.status='Information on Wrox books.'">Books</a>//状态栏信息
    <a href="javascript:history.go(-1)">Back to the previous page</a>//前一页,也可以用history.back(),后一页history.forward()
    </body>
    </html>

  • 相关阅读:
    积分第一中值定理
    History of mathematics(19th century)
    使用多项式解决矩阵问题
    菊与刀
    Mathematics during the Scientific Revolution(18th century)
    摄动
    Cauchy中值定理
    Leetcode3---Longest Substring Without Repeating Characters
    Leetcode2---Add Two Numbers
    矩形覆盖
  • 原文地址:https://www.cnblogs.com/gull/p/1907216.html
Copyright © 2020-2023  润新知