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

link to another page with button

P: n/a
Can I link to another page with a <input type=button> without javascript???

Thanks
Jul 20 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
" wrote:
Can I link to another page with a <input type=button> without
javascript???


What do you actually want to achieve?
Form buttons are there to submit forms. If you want to link to another
site, you use <a ...></a>. You can style the link to look like a
button, though.

--
Google Blogoscoped
http://blog.outer-court.com
Jul 20 '05 #2

P: n/a
MH
> Can I link to another page with a <input type=button> without
javascript???

Yes, you can;

<FORM action="page.htm"><INPUT type=submit value="whateverbuttontext"><a
href="page.htm" ></a></FORM>

-------
MH
Jul 20 '05 #3

P: n/a
"MH" <no****@nowhere.no> schrieb im Newsbeitrag
news:bs**********@news1.tilbu1.nb.home.nl...
Can I link to another page with a <input type=button> without

javascript???

Yes, you can;

<FORM action="page.htm"><INPUT type=submit value="whateverbuttontext"><a
href="page.htm" ></a></FORM>

-------
MH


What is the reason for the empty link?

<FORM action="page.htm">
<INPUT type=submit value="whateverbuttontext">
</FORM>

should do it anyway?

--
Markus
Jul 20 '05 #4

P: n/a
MH
> > <FORM action="page.htm"><INPUT type=submit value="whateverbuttontext"><a
href="page.htm" > </a></FORM>
What is the reason for the empty link?
I cut&pasted the example out of a page I made. Next to the button was a
small clickable image link to the same 'page.htm', like;
FORM action="page.htm">
INPUT type=submit value="whateverbuttontext">
<a href="page.htm" ><img src="image,.jpg" alt="..."></a>
/FORM>

For the example I deleted the 'img' bit and forgot to delete the 'href'
<FORM action="page.htm">
<INPUT type=submit value="whateverbuttontext">
</FORM>
should do it anyway?


Yes, correct,
and if you want 'page.htm' to open in a new window you can add 'target
="_blank"' to the FORM part;

<FORM action="page.htm" target="_blank">
<INPUT type=submit value="whateverbuttontext">
</FORM>

--------
MH
Jul 20 '05 #5

P: n/a
In article <bs**********@nic.grnet.gr>, ch******@hotmail.NOSPAM.com
says...
Can I link to another page with a <input type=button> without javascript???

Thanks


Bonus suggestion, if you want to use an image button rather than the
default one, plus pass hidden variables to the target page:

<form action="target_page.php" method="post">
<input type=hidden name=optional_parameter value=something_if_want>
<input type=image src="imagedirectory/custom_button.gif">
</form>

Geoff M
Jul 20 '05 #6

P: n/a
On Tue, 23 Dec 2003, Geoff Muldoon wrote:
Bonus suggestion, if you want to use an image button rather than the
default one, plus pass hidden variables to the target page: [..] <input type=image src="imagedirectory/custom_button.gif">


If you're going to apply for the bonus, at least your answer should be
reasonably complete!

1: don't forget an alt= attribute, for the use of text browsers

2: don't forget to remind the O.P about the special form of the
submitted parameters (clue: .x and .y) when input type=image is used.

cheers
Jul 20 '05 #7

P: n/a
On Mon, 22 Dec 2003, Markus Ernst wrote:
"MH" <no****@nowhere.no> schrieb im Newsbeitrag
news:bs**********@news1.tilbu1.nb.home.nl...
Can I link to another page with a <input type=button> without

javascript???

Yes, you can;

<FORM action="page.htm"><INPUT type=submit value="whateverbuttontext"><a
href="page.htm" ></a></FORM>


What is the reason for the empty link?

<FORM action="page.htm">
<INPUT type=submit value="whateverbuttontext">
</FORM>

should do it anyway?


I don't know if the above code would work, but if one can do it with a FORM
construct, shouldn't one explicitly add "METHOD=GET" to it? Some browser
clients might default to PUT or POST without it - since those are more commonly
used with form constructs.
Jul 20 '05 #8

P: n/a
"D. Stussy" <kd****@bde-arc.ampr.org> schrieb im Newsbeitrag
news:Pi******************************@kd6lvw.ampr. org...
On Mon, 22 Dec 2003, Markus Ernst wrote:
"MH" <no****@nowhere.no> schrieb im Newsbeitrag
news:bs**********@news1.tilbu1.nb.home.nl...
> Can I link to another page with a <input type=button> without
javascript???

Yes, you can;

<FORM action="page.htm"><INPUT type=submit value="whateverbuttontext"><a href="page.htm" ></a></FORM>
What is the reason for the empty link?

<FORM action="page.htm">
<INPUT type=submit value="whateverbuttontext">
</FORM>

should do it anyway?


I don't know if the above code would work, but if one can do it with a

FORM construct, shouldn't one explicitly add "METHOD=GET" to it? Some browser
clients might default to PUT or POST without it - since those are more commonly used with form constructs.


I think as long as you don't pass any additional data the server will not
care about the method. Actually there is no reason to use a form in this
case anyway, as buttons usually do not look nicer than a normal link. But
that was not the question ;-)

--
Markus
Jul 20 '05 #9

P: n/a
On Wed, 24 Dec 2003, Markus Ernst wrote:
"D. Stussy" <kd****@bde-arc.ampr.org> schrieb im Newsbeitrag
news:Pi******************************@kd6lvw.ampr. org...
On Mon, 22 Dec 2003, Markus Ernst wrote:
"MH" <no****@nowhere.no> schrieb im Newsbeitrag
news:bs**********@news1.tilbu1.nb.home.nl...
> > Can I link to another page with a <input type=button> without
> javascript???
>
> Yes, you can;
>
> <FORM action="page.htm"><INPUT type=submit value="whateverbuttontext"><a > href="page.htm" ></a></FORM>

What is the reason for the empty link?

<FORM action="page.htm">
<INPUT type=submit value="whateverbuttontext">
</FORM>

should do it anyway?


I don't know if the above code would work, but if one can do it with a

FORM
construct, shouldn't one explicitly add "METHOD=GET" to it? Some browser
clients might default to PUT or POST without it - since those are more

commonly
used with form constructs.


I think as long as you don't pass any additional data the server will not
care about the method. Actually there is no reason to use a form in this
case anyway, as buttons usually do not look nicer than a normal link. But
that was not the question ;-)


Not true. Apache (apparently the most popular, so they claim) cares. One can
limit access to resources by method - so if a wrong method is chosen, access is
denied. I don't know (or really care) about others, including M$ IIS.
Jul 20 '05 #10

P: n/a
MH
> > <FORM action="page.htm">
<INPUT type=submit value="whateverbuttontext">
</FORM>
should do it anyway?
I don't know if the above code would work
Yes, it does work and validates as html 4,01
but if one can do it with a FORM
construct, shouldn't one explicitly add "METHOD=GET" to it?


Yes you could, but GET is the default method
If the 'page.htm' is given as URI http://www........../page.htm , POST will
not work ---> 404, though the example given at
http://www.w3.org/TR/html401/interact/forms.html shows the use of POST )

<FORM METHOD="get" action="http://www....../page.htm">
<INPUT type="submit" value="whateverbuttontext">
</FORM>
Jul 20 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.