redirection on the form button?

K

kaeli

[email protected] enlightened us said:
how create redirection to some URL by clicking on the form button?

any ideas?

Plenty.
The simplest being
onClick="top.location.replace('myNewLocation.html');"
(which will also break out of a frameset)

There are more ways to do this (server-side, mostly) if you need to pass
header or request info or want to keep history, replace only one frame, etc.

--
 
X

xman

Plenty.
The simplest being
onClick="top.location.replace('myNewLocation.html');"
(which will also break out of a frameset)
RE: sorry I am javascript newbie

where add it:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<form name="form1" method="post" action="">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<p>&nbsp;</p>
</body>
</html>
 
X

xman

I am try next, but not work:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="">
<p>&nbsp; </p>
<p>
<input type="submit" name="Submit"
onclick="top.location.replace('myNewLocation.html');" value="Submit">
</p>
</form>
</body>
</html>
 
X

xman

and

<input type="submit" name="Submit"
onclick="top.location.replace('myNewLocation.html');form1.submit();">


but nothing..
 
X

xman

error is: HTTP405 Resource not allowed

xman said:
and

<input type="submit" name="Submit"
onclick="top.location.replace('myNewLocation.html');form1.submit();">


but nothing..
 
K

kaeli

[email protected] enlightened us said:
and

<input type="submit" name="Submit"
onclick="top.location.replace('myNewLocation.html');form1.submit();">


but nothing..

You can't do that. The replace of the location wipes out the form.

What exactly are you trying to accomplish here? I think there's a better way
for you than this.
If you just want to redirect to a page when a user clicks a button, do it
this way:

<form>
<input type="button" name="b1" value="click here"
onClick="top.location.replace('myPage.html');">
</form>

Note: change myPage.html to a REAL page/URL. That's just an example.

--
 
P

PHP2

What exactly are you trying to accomplish here? I think there's a better
way
for you than this.
If you just want to redirect to a page when a user clicks a button, do it
this way:

<form>
<input type="button" name="b1" value="click here"
onClick="top.location.replace('myPage.html');">
</form>

Note: change myPage.html to a REAL page/URL. That's just an example.


RE: yes it work, if I have not form action "/masterpanel/index.cgi"!

but I must have it because YES button!
<form name="form1" method="post" action="/masterpanel/index.cgi">

how can NO button work at same time?
 
P

PHP2

no, all is ok!

thanks :-D


PHP2 said:
RE: yes it work, if I have not form action "/masterpanel/index.cgi"!

but I must have it because YES button!
<form name="form1" method="post" action="/masterpanel/index.cgi">

how can NO button work at same time?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top