By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,775 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,775 IT Pros & Developers. It's quick & easy.

redirection on the form button?

P: n/a
how create redirection to some URL by clicking on the form button?

any ideas?
Jul 23 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
In article <d2**********@ss405.t-com.hr>, no****@xxx.com enlightened us
with...
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.

--
--
~kaeli~
What do they use to ship styrofoam?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2

P: n/a
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>
Jul 23 '05 #3

P: n/a
and

<input type="submit" name="Submit"
onclick="top.location.replace('myNewLocation.html' );form1.submit();">
but nothing..
"xman" <no****@xxx.com> wrote in message news:d2*********@ss405.t-com.hr...
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>

Jul 23 '05 #4

P: n/a
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>
Jul 23 '05 #5

P: n/a
error is: HTTP405 Resource not allowed

"xman" <no****@xxx.com> wrote in message news:d2*********@ss405.t-com.hr...
and

<input type="submit" name="Submit"
onclick="top.location.replace('myNewLocation.html' );form1.submit();">
but nothing..
"xman" <no****@xxx.com> wrote in message
news:d2*********@ss405.t-com.hr...
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>


Jul 23 '05 #6

P: n/a
In article <d2*********@ss405.t-com.hr>, no****@xxx.com enlightened us
with...
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.

--
--
~kaeli~
I can't sleep. The clowns might eat me.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #7

P: n/a

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?
Jul 23 '05 #8

P: n/a
no, all is ok!

thanks :-D
"PHP2" <no****@nospam.tv> wrote in message
news:d2**********@ss405.t-com.hr...

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?

Jul 23 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.