<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()没有执行!
答案 0 :(得分:8)
oneclick
事件处理程序名称应为onclick
答案 1 :(得分:4)
oneclick是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>
答案 2 :(得分:3)
<input id = "button1" type = "button" value = "click" onclick = "oneClick();" />
现在应该可以正常工作了。 用onclick =“”
替换oneclick