zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    2019-11-4:渗透测试,bypass学习,笔记
    2019-11-3:渗透测试,基础学习,bypass类型笔记
    Linux常用命令集合
    HBase(0.96以上版本)过滤器Filter详解及实例代码
    Hadoop安全模式
    Linux学习笔记--一些错误的记录
    GUG记录
    为什么 1000 == 1000会返回false,100 == 100会返回true
    关于解决mysql数据库乱码的问题
    《MVC实现用户权限》
  • 原文地址:https://www.cnblogs.com/gull/p/1907216.html
Copyright © 2011-2022 走看看