2016-03-14 127 views
-4

我已經研究了一些JavaScript代碼..順便說一句,我是新手:)。這裏有個問題:什麼是「警戒」功能?什麼是警報功能?

<html> 
 
<body> 
 
<h1>Counting rabbits</h1> 
 
<script>  
 
for(var i=1; i<=3; i++) 
 
{  alert("Rabbit "+i+" out of the hat!")  } 
 
</script>  
 
<h1>...Finished counting</h1> 
 

 
</body> 
 
</html>

+0

顯示警告框 – Ramanlfc

+0

爲了幫助您的學習:MDN是一個很好的資源。以下是他們對報警功能頁面:https://developer.mozilla.org/en-US/docs/Web/API/Window/alert – Hatchet

+0

而只是一個SO提示 - 你收到了一些downvotes的,因爲你可以很容易地研究這個你自己。它期望你在問社區之前挖掘它。 – Bosworth99

回答

0

alert函數的功能是顯示一個警告框,如下所示: enter image description here

通常最好說window.alert,而不是僅僅alert