Solved

Form submit in Netscape

Posted on 2000-03-14
7
167 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
Comment Utility
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
Comment Utility
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
Comment Utility
What about giving an action to the form tag?

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

xabi
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Expert Comment

by:chteril
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks... that's it :-) This thing gave me a bit of an head ache...

Jonny...
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Unable to get blue colour in background of using HTML 6 56
html select on change 3 25
Hover Gone 16 30
Bootstrap Datable Spinner 3 28
Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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 tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

744 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

18 Experts available now in Live!

Get 1:1 Help Now