jonnyfive
asked on
Form submit in Netscape
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...
<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();">
</Form>
I just try to submit the page, without using a submit button (in my original code I use a image).
Regards, Jonny...
ASKER
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...
Regards, Jonny...
What about giving an action to the form tag?
<form name="TheForm" action="file.asp">
xabi
<form name="TheForm" action="file.asp">
xabi
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='t est.html';
document.TheForm.submit();
}
</Script>
<form name="TheForm">
<a href="JavaScript:Test();"> Just a Test</A>
</Form>
</body>
</html>
<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='t
document.TheForm.submit();
}
</Script>
<form name="TheForm">
<a href="JavaScript:Test();">
</Form>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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.
<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.
ASKER
Thanks... that's it :-) This thing gave me a bit of an head ache...
Jonny...
Jonny...
<script language="javascript">
<!--
function submitit() {
document.myform.submit()
}
//-->
</script>
</head>
<body>
<form name="myform" ....>
</form>
<br>
<a href="JavaScript:submitit(
..
..
xabi