Solved

Form submit in Netscape

Posted on 2000-03-14
7
168 Views
Last Modified: 2010-04-09
Hi everyone... I have the following test JavaScript code, which works perfertly in IE 5, but not in Netscape Navigator 4.09. Does anyone know why?

<form name="TheForm">
<Script Language="JavaScript">
  // Just to see if this page was submited, we show a alert box
  alert('test');
  function Test()  
  {  
     TheForm.submit();
  }
  </Script>
  <a href="JavaScript:Test();">Just a Test</A>
</Form>

I just try to submit the page, without using a submit button (in my original code I use a image).

Regards, Jonny...
0
Comment
Question by:jonnyfive
7 Comments
 
LVL 8

Expert Comment

by:xabi
ID: 2615386
make this:

<script language="javascript">
<!--
function submitit() {
 document.myform.submit()
}
//-->
</script>
</head>
<body>
<form name="myform" ....>
</form>
<br>
<a href="JavaScript:submitit();">Just a Test</A>
..
..

xabi
0
 

Author Comment

by:jonnyfive
ID: 2615420
This doesn't work either. Anyone else, please don't answer this question. If you think you have the answer, write it as a comment. If it solves my problem, I will accept the comment as the answer.

Regards, Jonny...
0
 
LVL 8

Expert Comment

by:xabi
ID: 2615431
What about giving an action to the form tag?

<form name="TheForm" action="file.asp">

xabi
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:chteril
ID: 2615446
you just have to move your javascript:

<html>
<head></head>
<body>
<Script Language="JavaScript">
  // Just to see if this page was submited, we show a alert box
  alert('test:');
  function Test()    
  {  
      document.TheForm.action='test.html';
     document.TheForm.submit();
  }
  </Script>
<form name="TheForm">

  <a href="JavaScript:Test();">Just a Test</A>
</Form>


</body>
</html>
0
 
LVL 8

Accepted Solution

by:
xabi earned 100 total points
ID: 2615448
I tried the code and it works if you add at least 1 field to the <form>

working example:

<html>
<head>
<title>Example</title>
<script language="javascript">
<!--
function submitit() {
 alert("pepe")
 document.myform.submit()
}
//-->
</script>
</head>
<body>
<form name="myform" action="http://search.yahoo.com/bin/search" method="get">
<input type="hidden" name="p" value="www">
</form>
<br>
<a href="JavaScript:submitit()">Just a Test</A>
</body>
</html>

xabi
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2615462
You can use OnSubmit in the form like

<form name="myform" action="somewhere.html" OnSubmit="return javascriptfunction">

if the function returns true then it will go to somewhere.html otherwise it'll stay on the same screen.
0
 

Author Comment

by:jonnyfive
ID: 2615494
Thanks... that's it :-) This thing gave me a bit of an head ache...

Jonny...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now