Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using window.location to redirect user

Status
Not open for further replies.

kevink

Programmer
Nov 23, 1999
53
IE
I want to redirect the user to a different page depending on what type of choices they make on a form using javascript (client side).

Does anyone know how to do this - or whats wrong with the code below?

<head>
<script language=&quot;javascript&quot;>
function formChoice(theform) {
window.location = &quot;newpage.htm&quot;
}
</script>
</head>

<body>
<form name=&quot;ex&quot; onsubmit=&quot;formchoice(this)&quot;>
.....

Naturally the actual script has if statements etc. which are left out here!

TIA,

Kevin [sig][/sig]
 
What results are you getting? FYI, when using an onsubmit handler, you should always assure that you can get a return value. If you don't, or if the return value is false, then the form won't get submitted. Also note that the onsubmit event only fires if you use a submit button to submit the form. If you do the submit in Javascript, there's no onsubmit event.

Seeing a little more of the code will help. [sig]<p>nick bulka<br><a href=mailto: > </a><br><a href= </a><br>Get your technical books at Bulka's Books<br>
[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top