2012-06-01 164 views
0
<html> 
<head> 
<title>Page title</title> 
<script language="JavaScript" type="text/javascript"> 

     function oneClick() 
     { 
     document.write ("oneClick() executed."); 
     } 
</script> 

</head> 
<body> 

<input id = "button1" type = "button" value = "click" oneclick = "oneClick()" /> 

</body> 
</html> 

點擊按鈕後沒有任何反應,我認爲oneClick()不會執行!oneclick事件處理程序不執行

回答

8

oneclick事件處理程序的名稱應該是onclick

4

一鍵式是的onclick

<html> 
<head> 
<title>Page title</title> 
<script language="JavaScript" type="text/javascript"> 

     function oneClick() 
     { 
     document.write ("oneClick() executed."); 
     } 
</script> 

</head> 
<body> 

<input id = "button1" type = "button" value = "click" onclick = "oneClick()" /> 

</body> 
</html> 
3
<input id = "button1" type = "button" value = "click" onclick = "oneClick();" /> 

它應該工作正常了。 用onclick替換oneclick =「」

相關問題