File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes IE and Netscape Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "IE and Netscape" Watch "IE and Netscape" New topic
Author

IE and Netscape

Varsha Redkar
Greenhorn

Joined: Jun 14, 2001
Posts: 6
Hi,
I have a form wich needs to be submitted using a Javascript. The condensed code is as follows:
<html>
<head>
<script language='javascript'>
function doit()
{
document.f.action = "path of the cgi";
document.f.submit();
alert("Your information has been sent to the Admissions dept");
addr = "redirection addr";
window.location=addr;
return true;
}
</script>

<title></title>
</head>
<body bgcolor="#FFFFDD" link="#0000FF" vlink="#0000FF">

<hr><form METHOD="post" name="f">
<INPUT TYPE="hidden" NAME="mailform_addresses" VALUE="abc@abc.edu">
<INPUT TYPE="text" NAME="addr" value="">

<INPUT TYPE=button NAME="button" VALUE="Submit your Registration"
onClick="return doit();">  <input type="reset" name="reset" value="Reset Form"><BR><BR>
</CENTER></form>
<br><br>
</body>
</html>

The CGI mails the form field contents to the address in the hodden field.
This form works fine in Netscape. But, it fails to work as desired in IE. It calls the Javascript and even displays the laerts. But, it does not call the CGI and does not open the redirection page properly.
This is kind of urgent so it would be really nice if someone could get back to me with a possible solution.
Thanks,
Varsha.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
In IE you will need to use window.navigate(URL) or window.location.replace(URL).
Varsha Redkar
Greenhorn

Joined: Jun 14, 2001
Posts: 6
Tried it...but it still does not work. The CGI is not executed at all...
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
This may be a silly question, but can you invoke the CGI program by typing it directly into the address bar?
Varsha Redkar
Greenhorn

Joined: Jun 14, 2001
Posts: 6
I am not the person using the CGI.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Now I'm really confused . If you are not the person using the CGI, then how do you know that it isn't being executed from your Javascript? Are you unable to access the CGI for testing purposes?
Neil M
Greenhorn

Joined: Jul 23, 2001
Posts: 9
You're missing ".href" for your window.location line:
Try
window.location.href
or
location.href
------------------
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IE and Netscape
 
Similar Threads
JavaScript to Java Applet Comm W/O Plug-in
java Script Program
No scrolling in text input after uppercase ?
problem with my jsp page
Need Help With Dynamic text box in JSP