Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Form submit in Netscape

Posted on 2000-03-14
7
172 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
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 style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

828 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