<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Welcome 布拉格

    BlogJava 首頁 聯系 聚合 管理
      6 Posts :: 13 Stories :: 15 Comments :: 0 Trackbacks

    1)Alert box
    <html>
    <head>
    <script type="text/javascript">
    function disp_alert()
    {
    alert("I am an alert box!!")
    }
    </script>
    </head>
    <body>

    <input type="button" onclick="disp_alert()" value="Display alert box" />

    </body>
    </html>

    (2) confirm box
    <html>
    <head>
    <script type="text/javascript">
    function disp_confirm()
    ? {
    ? var r=confirm("Press a button")
    ? if (r==true)
    ??? {
    ??? document.write("You pressed OK!")
    ??? }
    ? else
    ??? {
    ??? document.write("You pressed Cancel!")
    ??? }
    ? }
    </script>
    </head>
    <body>

    <input type="button" onclick="disp_confirm()" value="Display a confirm box" />

    </body>
    </html>

    (3)
    Prompt box

    <html>
    <head>
    <script type="text/javascript">
    function disp_prompt()
    ? {
    ? var name=prompt("Please enter your name","Harry Potter")
    ? if (name!=null && name!="")
    ??? {
    ??? document.write("Hello " + name + "! How are you today?")
    ??? }
    ? }
    </script>
    </head>
    <body>

    <input type="button" onclick="disp_prompt()" value="Display a prompt box" />

    </body>
    </html>

    (4)
    ?Call a function1

    <html>
    <head>

    <script type="text/javascript">
    function myfunction()
    {
    alert("HELLO")
    }
    </script>

    </head>
    <body>

    <form>
    <input type="button"
    onclick="myfunction()"
    value="Call function">
    </form>

    <p>By pressing the button, a function will be called. The function will alert a message.</p>

    </body>
    </html>


    (5)
    Function with an argument

    <html>
    <head>

    <script type="text/javascript">
    function myfunction(txt)
    {
    alert(txt)
    }
    </script>

    </head>
    <body>

    <form>
    <input type="button"
    onclick="myfunction('Hello')"
    value="Call function">
    </form>

    <p>By pressing the button, a function with an argument will be called. The function will alert
    this argument.</p>

    </body>
    </html>


    (7)Function with an argument 2

    <html>
    <head>
    <script type="text/javascript">
    function myfunction(txt)
    {
    alert(txt)
    }
    </script>
    </head>

    <body>
    <form>
    <input type="button"
    onclick="myfunction('Good Morning!')"
    value="In the Morning">

    <input type="button"
    onclick="myfunction('Good Evening!')"
    value="In the Evening">
    </form>

    <p>
    When you click on one of the buttons, a function will be called. The function will alert
    the argument that is passed to it.
    </p>

    </body>
    </html>

    (8)
    Function_return
    <html>
    <head>

    <script type="text/javascript">
    function myFunction()
    {
    return ("Hello, have a nice day!")
    }
    </script>

    </head>
    <body>

    <script type="text/javascript">
    document.write(myFunction())
    </script>

    <p>The script in the body section calls a function.</p>

    <p>The function returns a text.</p>

    </body>
    </html>

    (9)

    <html>
    <head>
    <script type="text/javascript">
    function product(a,b)
    {
    return a*b
    }
    </script>
    </head>

    <body>
    <script type="text/javascript">
    document.write(product(4,3))
    </script>
    <p>The script in the body section calls a function with two parameters (4 and 3).</p>
    <p>The function will return the product of these two parameters.</p>
    </body>
    </html>

    (10)
    loop

    <html>
    <body>

    <script type="text/javascript">
    for (i = 0; i <= 5; i++)
    {
    document.write("The number is " + i)
    document.write("<br />")
    }
    </script>

    <p>Explanation:</p>

    <p>This for loop starts with i=0.</p>

    <p>As long as <b>i</b> is less than, or equal to 5, the loop will continue to run.</p>

    <p><b>i</b> will increase by 1 each time the loop runs.</p>

    </body>
    </html>


    (11)
    <html>
    <body>

    <script type="text/javascript">
    for (i = 1; i <= 6; i++)
    {
    document.write("<h" + i + ">This is header " + i)
    document.write("</h" + i + ">")
    }
    </script>

    </body>
    </html>


    (12)
    <html>
    <body>

    <script type="text/javascript">
    i = 0
    while (i <= 5)
    {
    document.write("The number is " + i)
    document.write("<br />")
    i++
    }
    </script>

    <p>Explanation:</p>

    <p><b>i</b> is equal to 0.</p>

    <p>While <b>i</b> is less than , or equal to, 5, the loop will continue to run.</p>

    <p><b>i</b> will increase by 1 each time the loop runs.</p>

    </body>
    </html>

    (13)
    <html>
    <body>

    <script type="text/javascript">
    i = 0
    do
    {
    document.write("The number is " + i)
    document.write("<br />")
    i++
    }
    while (i <= 5)
    </script>

    <p>Explanation:</p>

    <p><b>i</b>? equal to 0.</p>

    <p>The loop will run</p>

    <p><b>i</b> will increase by 1 each time the loop runs.</p>

    <p>While <b>i</b> is less than , or equal to, 5, the loop will continue to run.</p>


    </body>
    </html>

    (14)
    <html>
    <body>
    <script type="text/javascript">
    var i=0
    for (i=0;i<=10;i++)
    {
    if (i==3){break}
    document.write("The number is " + i)
    document.write("<br />")
    }
    </script>
    <p>Explanation: The loop will break when i=3.</p>
    </body>
    </html>

    (15)
    <html>
    <head>
    <script type="text/javascript">
    var txt=""
    function message()
    {
    try
    ?? {
    ?? adddlert("Welcome guest!")
    ?? }
    catch(err)
    ?? {
    ?? txt="There was an error on this page.\n\n"
    ?? txt+="Error description: " + err.description + "\n\n"
    ?? txt+="Click OK to continue.\n\n"
    ?? alert(txt)
    ?? }
    }
    </script>
    </head>

    <body>
    <input type="button" value="View message" onclick="message()" />
    </body>

    </html>

    posted on 2007-09-27 10:13 Welcome 閱讀(1554) 評論(0)  編輯  收藏 所屬分類: javascript

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 亚洲精品岛国片在线观看| 无码人妻精品中文字幕免费| 最新仑乱免费视频| 亚洲人成7777影视在线观看| 亚洲日本va在线视频观看| 爱情岛论坛亚洲品质自拍视频网站| 无码中文在线二区免费| 亚洲性无码一区二区三区 | 在线看片免费人成视频福利| AA免费观看的1000部电影| 亚洲国产超清无码专区| jizz免费在线观看| 国产亚洲AV夜间福利香蕉149 | 国产成人亚洲精品影院| 精品乱子伦一区二区三区高清免费播放| 亚洲国产精品成人久久蜜臀 | 亚洲精品免费在线视频| 亚洲国产成AV人天堂无码| 一个人免费观看www视频在线| 亚洲一区AV无码少妇电影| 国产精品二区三区免费播放心| 免费VA在线观看无码| 国产亚洲情侣一区二区无| 亚洲国产精品久久久久秋霞小| 国内精品免费久久影院| 久久久久亚洲AV片无码下载蜜桃| 一级做a爱过程免费视频高清| 亚洲人JIZZ日本人| 在线视频免费观看爽爽爽| 日本亚洲欧美色视频在线播放 | 亚洲中文字幕无码亚洲成A人片| 免费一级做a爰片久久毛片潮喷| a在线观看免费视频| 色偷偷女男人的天堂亚洲网 | 最近2019中文字幕mv免费看| 永久免费无码日韩视频| 亚洲精品91在线| 国产精品免费播放| 一区二区在线免费观看| 久久精品亚洲日本波多野结衣 | 羞羞视频网站免费入口|