僅當用戶單擊時,下面的代碼才運行alert('Please enter your name!');取消上的提示。如果用戶沒有在提示框中輸入任何內容並點擊輸入,我試圖讓代碼也運行所述警報。但是,當他們輸入任何內容並點擊輸入時,代碼將呈現「Hello」。我該如何解決這個問題? var theName = prompt('What is your name?');
if(theName != nul
<html>
<head>
<meta charset="utf-8">
<script scr ="lecture01.js"></script>
</head>
<body>
this is a basic html page
</body>
警報功能無法正常工作。我用「alert(」hello world「);」作爲外部腳本文件