在图片中单击我编写用于调用java的代码
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<table cellpadding="0" cellspacing="0" width="311">
<tr>
<td height="14">
<img onclick ="SignIn();" border="0" src="../images/Sign_In.gif" width="80" height="28">
</td>
</tr>
</table>
<script type="text/javascript" language="JavaScript">
function SignIn(){
alert();
}
</script>
</body>
</html>
以上代码在Internet Explorer中正常运行,但在FireFox中运行不正常。有什么问题?
答案 0 :(得分:6)
答案 1 :(得分:2)
您需要将参数传递给警报。当IE显示空白警报时,似乎firefox不喜欢它。
alert("text here");
答案 2 :(得分:1)
以下是使用javascript验证网络表单时应始终执行的操作的示例:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<!-- Inline javacript should be always inside header tag -->
<script type="text/javascript">
function SignIn(){
alert("");//In firefox you have to pass something to alert to make it work
//More code logic you can put here
//...
//If everything is ok return TRUE to
//post data to "somepage.aspx" if
// dont return FALSE and do nothin
if(everythingIsOk);
return true;
else
return false;
}
</script>
</head>
<body>
<form method="post" action="somepage.aspx">
<table cellpadding="0" cellspacing="0" width="311">
<tr>
<td height="14">
<input type="image" src="../images/Sign_In.gif" width="80" height="28" onclick="return SignIn();">
</td>
</tr>
</table>
</form>
</body>
</html>
答案 3 :(得分:0)
我现在遇到了这个问题。 通过清理firefox中的缓存修复: 工具&gt;选项&gt;高级&gt;网络&gt;离线存储(缓存):“立即清除”