0
HTML表單顯示但未執行javascript回調。 (以及如何合併成一個文件?)未執行HTML/Javascript回調
THX
<html>
<head>
<title> Mouse click test</title>
</head>
<body>
<h1>Mouse Click Test</h1>
<p>Click the mouse on the test link below. A message below will indicate which button was clicked.</p>
<h2><a href = "#" id = "testlink">Test Link</a></h2>
<form name = "form1">
<textarea rows = "10" cols = "70" name = "info"></textarea>
</form>
<script type = "text/javascript" scr = "click.js">
</script>
</body>
</html>
function mousestatus(e){
document.write("hello");
if (!e) e = window.event;
btn = e.button;
whichone = (btn < 2) ? "Left" : "Right";
message = e.type + " : " + whichone + "\n";
document.form1.info.value += message;
}
obj = document.getElementById("testlink");
obj.onmousedown = mousestatus;
obj.onmouseup = mousestatus;
obj.onclick = mousestatus;
obj.ondblclick = mousestatus;
從函數中刪除'document.write(「hello」);''。 – Chandu
同樣的事情無論 –
如果js在click.js中,那麼腳本標籤有src屬性的拼寫錯誤。將'
不應該是src =「click.js」?
來源
2011-08-15 03:42:21 hugomg