我正在尝试从链接运行示例 javascript 代码:Link
FF 和 IE 上没有任何反应,扫描后,它只是清除了文本字段。这里有什么问题吗?
代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="javascript">
function ini()
{
// Retrieve the code
var code =document.getElementById ('code_read_box').value;
alert(code);
// Return false to prevent the form to submit
return false;
}
</script>
</head>
<body>
<form onsubmit = "return ini()">
<input type="text" id="code_read_box" value="" />
</form>
</body>
</html>
最佳答案
<script type="text/javascript">
而不是
<script type="javascript">
关于Javascript 示例程序无法运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3834977/