zoukankan      html  css  js  c++  java
  • javascript学习1

    范例

    <script type="text/javascript">

    {
    document.write("<h1>Hello World!</h1>")
    }

    js也可以赋值,比如h="hello";

    </script>

    发起警报

    function message()
    {
    alert("再次向您问好!在这里,我们向您演示" + ' ' + "如何向警告框添加折行。")
    }
    </script>
    </head>

    <body onload="message()">onload是加载的意思,也可以onclick

    引用外部js

    <script src="/js/example_externaljs.js">

    js的判断语句

    <script type="text/javascript">
    var d = new Date()
    var time = d.getHours()

    if (time < 10)
    {
    document.write("<b>早安</b>")
    }
    </script>

    这例就是定义变量,调用内置函数,进行判断,输出语句。

    选择框

    选择框继续使用内置函数confirm()

    现在自己写个例子

    <script type="text/javascript">

    {

    var d=confirm("dsadsa")

    if (d==true)

    {

    alert("you choose yes")

    }else{

    alert("you choose no")}

    }

  • 相关阅读:
    Python2.7-zlib
    Python2.7-sqlite3
    Python2.7-dbm、gdbm、dbhash、bsddb、dumbdb
    Python2.7-anydbm
    Python2.7-marshal
    Python2.7-shelve
    Python2.7-copy_reg
    Python2.7-pickle, cpickle
    Python2.7-shutil
    Python2.7-fnmacth
  • 原文地址:https://www.cnblogs.com/FortHorde/p/4635356.html
Copyright © 2011-2022 走看看