Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Form submit in Netscape

Posted on 2000-03-14
7
Medium Priority
?
176 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
[X]
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
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

618 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