亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Two commonly used client-side output methods in JavaScript

Two commonly used client output methods


document.write(str)

  • Description: In the <body> tag of the web page, output the content of str.

  • Document means "document", which is the entire web page.

  • Document is a document object that represents the entire web page.

  • write() is an output method of the document object.

  • "." Decimal point: Call the object's method through the decimal point (.).

  • str: ??Indicates the content to be output.

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>php.cn</title>
        <script type="text/javascript">
            //在<body>中輸出一句話(huà)
            document.write("歡迎來(lái)到php.cn");
        </script>
    </head>
    <body>
    </body>
</html>


##window.alert(str)

  • Description: Pops up a warning dialog box in the current window, str is the content displayed in the dialog box.

  • window represents the current browser window, and window is a window object.

  • alert() method: Pops up a dialog box.

  • str: ??Indicates the content to be output.

  • <!DOCTYPE HTML>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <title>php.cn</title>
            <script type="text/javascript">
                //打開(kāi)網(wǎng)頁(yè)時(shí),彈出一個(gè)對(duì)話(huà)框
                window.alert("歡迎來(lái)到php.cn");
            </script>
        </head>
        <body>
        </body>
    </html>


Continuing Learning
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script type="text/javascript"> //在<body>中輸出一句話(huà) document.write("歡迎來(lái)到php.cn"); </script> </head> <body> </body> </html>
submitReset Code