Javascript警告框没有出现 [英] Javascript Alert box is not appearing
本文介绍了Javascript警告框没有出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Javascript中编写了以下代码,当用户点击提交按钮时显示警告框但单击提交按钮时没有出现警告框:
I have written the following code in Javascript to show alert box when user clicks on "Submit" button but alert box is not appearing on clicking submit button:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Javascipt Tag Position</title>
<script type="text/javascript" language="javascript">
funciton hello()
{
alert("Script inside head tag!");
}
</script>
</head>
<body>
<input type="submit" name="sub" value="Submit" onclick="hello()">
</body>
</html>
注意:我已将此文件另存为js1 .php因为我也在学习php。
Note: I have saved this file as "js1.php" since i am learning php as well.
推荐答案
你拼错了函数为funciton
You've misspelled "function" as "funciton"
使用以下代码:
函数hello()
{
alert(head tag1内的脚本!);
返回false;
}
这样可行..
Use below code:
function hello()
{
alert("Script inside head tag1!");
return false;
}
This will work..
这篇关于Javascript警告框没有出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文