<!DOCTYPE html>
<html lang="zh-Hant-TW">
<head>
    <title>function</title>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <style type="text/css">
        
    </style>

</head>

<body>

    <p id="paragraph"></p>

    <script type="text/javascript">

        function alertMe() {

            alert("Hello Bruce!");

        }   // 定義function


        alertMe();   //調用function

        // --------------------------------

        function alertMe( a , b ) {

            alert( a + b );

        }  

        alertMe(3 , 5);   //不會回傳值

        // --------------------------------

        function alertMe( a , b ) {

            return( a + b );

        }  

        document.getElementById("paragraph").innerHTML = alertMe ( 6 , 3 );  // 回傳並附值

    </script>

</body>
</html>

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 A&B 的頭像
    A&B

    網頁前端新手上路辛酸史

    A&B 發表在 痞客邦 留言(0) 人氣()