HighDots Forums  

what's wrong with this?

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss what's wrong with this? in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
andre
 
Posts: n/a

Default what's wrong with this? - 06-26-2004 , 11:10 AM






Hi,

When i click on OK of the confirm, nothing happens.
Why am i not redirected to head.asp file?

thanks
andre

the code:
<body>
<form name=ins2 method="post" onsubmit="return go2nclick()">
<INPUT id=go2 TYPE="submit" value="test" >
</form>
</body>

<script type="text/javascript">
function go2nclick()
{
if (confirm("If you are sure, click OK"))
{
window.location.href="hoofd.asp"
return true;
}
}
</script>



Reply With Quote
  #2  
Old   
Andre Herbst
 
Posts: n/a

Default Re: what's wrong with this? - 08-08-2004 , 02:17 AM






andre wrote:
Quote:
Hi,

When i click on OK of the confirm, nothing happens.
Why am i not redirected to head.asp file?

form name=ins2 method="post" onsubmit="return go2nclick()"
INPUT id=go2 TYPE="submit" value="test"
Its because you use the submit button to redirect. If you now klick on the
button you will be redirected to the page. But very shortly after
redirecting to your page the browser tries to submit the formular. You
should use a normal button instead of the submit button:

<INPUT id=go2 TYPE="button" value="test">




Reply With Quote
  #3  
Old   
Andre Herbst
 
Posts: n/a

Default Re: what's wrong with this? - 08-08-2004 , 02:19 AM



Andre Herbst wrote:
Quote:
andre wrote:
Hi,

When i click on OK of the confirm, nothing happens.
Why am i not redirected to head.asp file?

form name=ins2 method="post" onsubmit="return go2nclick()"
INPUT id=go2 TYPE="submit" value="test"

Its because you use the submit button to redirect. If you now klick
on the button you will be redirected to the page. But very shortly
after redirecting to your page the browser tries to submit the
formular. You should use a normal button instead of the submit button:

INPUT id=go2 TYPE="button" value="test"
of course you now need to put the onsubmit as onclick into the input-tag:

<INPUT id=go2 TYPE="button" value="test" onclick="return go2nclick()">




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.