?
Solved

Form submit in Netscape

Posted on 2000-03-14
7
Medium Priority
?
175 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
Industry Leaders: 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Suggested Courses

801 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