close
按下Push me!出現My first Javascript
<html>
<head>
<script> //script拼錯
function myFun() //沒打function
{
document.write("My first Javascript"); //輸出字串的語法,同等於printf //write拼錯且忘了打;
}
</script>
</head>
<body>
<button type="button" onclick="myFun()"> //onclick去呼叫function的函數
Push me!
</button>
</body>
</html>
此單元學到:透過button呼叫函數名稱
函數設定方式:function 函數名稱()
{
設定輸出字串
}
後記:
真是殘念
本以為很簡單
結果自己從無到有打過一遍
錯一堆
紅色標註我錯的地方
下次要記得
全站熱搜