Reputation: 1973
In the image click I write code for invoke java like this
<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>
The above code is working fine in Internet Explorer, but not in FireFox. What is the problem?
Upvotes: 1
Views: 1020
Reputation: 8170
Try this:
{ alert(); document.getElementById('FormSignIn').submit(); }
Documentation: document.getElementById
Upvotes: 6
Reputation: 222
I got this problem now. Fixed by cleaning cache in firefox : Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
Upvotes: 0
Reputation: 18153
Here is an exemple of what you should always do when validating web forms with 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>
Upvotes: 1
Reputation: 23823
You need to pass an argument to alert. Seems firefox doesn't like it when you don't while IE shows a blank alert.
alert("text here");
Upvotes: 2