[英]java script alert message doesn't seem to show
so-far I have tried everything. 到目前为止,我已经尝试了一切。 My code is below but when I run it nothing seems to happen, nor do I get any error messages.
我的代码在下面,但是当我运行它时,似乎什么也没有发生,也没有收到任何错误消息。 I'm working with Toad for oracle, so I'm literally hard-coding
我正在与Toad for oracle一起工作,所以我实际上是在进行硬编码
-- form field and button -- -表单字段和按钮-
http.p ('<input type="form" method="post" name="idstu" id="idstu" placeholder="e.g. 000123456">');
htp.br;
htp.p (' <input type="submit" onclick="confirmMsg()" value="Submit">');
-- javascript -- -JavaScript-
http.p ('<script type="text/javascript">
function confirmMsg() {
var field1 = document.getElementById("idstu").value;
alert(field1 "has been unsuspended");
}');
请尝试删除<input>
标记中的type=submit
。
your code would be causing error . 您的代码将导致错误。
<input type="form" method="post" name="idstu" id="idstu" placeholder="e.g. 000123456">
it should be type='text'.And alert should be like : 它应该是type ='text'.alert应该像这样:
alert(field1+"has been unsuspended");
}
</script> <!--must have the habit to close each tag -->
Below the working answer. 下面的工作答案。
<html>
<head>
<script type="text/javascript">
function confirmMsg() {
var field1 = document.getElementById("idstu").value;
alert(field1+"has been unsuspended");
}
</script>
</head>
<body>
<input type="form" method="post" name="idstu" id="idstu" placeholder="e.g. 000123456">
<input type="submit" onclick="confirmMsg()" value="Submit">
</body>
</html>
i've got it to work. 我有它的工作。 first of all as @liju mentioned i didn't close the script tag as i have thousands of lines(stupid mistake).
首先,因为@liju提到我没有关闭脚本标签,因为我有数千行(愚蠢的错误)。 2nd i played around with the code again and changed the input types of both field and button.
第二,我再次使用该代码,并更改了字段和按钮的输入类型。 now i do get the alert message.
现在我确实收到警报消息。 Thanks everyone .
感谢大家 。 --working code below.
-下面的工作代码。 --
-
htp.p ('<input type="text" method="post" name="idstu" id="idstu" placeholder="e.g. 000123456">');
htp.br;
htp.p (' <input type="button" onclick="confirmMsg()" value="Submit">');
htp.p ('<script type="text/javascript">
function confirmMsg() {
var field1 = document.getElementById("idstu").value;
alert(field1+"has been unsuspended");
}
</script>');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.