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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to link to status HTML page using Button

Status
Not open for further replies.

DJR999

Programmer
Nov 19, 2003
16
0
0
US
I know this is probably ridiculously simple, but I can't seem to get it to work. I just want a button on an html page to link to another html page. Nothing going back to the server - just a straight link to another static page.

I've tried just wrapping the button tag in an anchor like this:

<a href="otherpage.htm"><INPUT type="button" value="Go Now"></a>

This works in Netscape, but not in IE. In IE the link shows up in the status bar when you mouse over it, but clicking on it does nothing.

Thanks.
 
i would just style the link so it looks like a button. a link was meant to LINK you to another page, so why try to recreate it's functionality.

if you must, you could use javascript to redirect the user to another page using a button, but keep in mind that according to studies roughly 10% of users browse the internet with javascript disabled.

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Sorry - I'm new to webstuff, so I'm not clear on what your saying in either case.

When you say style the link so it looks like a button, do you mean in css or inline style just set color, background-color, width, etc, so it looks like a button on the screen?

As for the javascript, I tried that using onClick, but using a window.open("otherpage.htm") opens a separate window. How do you just link it to the same window?

Thanks.
 
yes, i mean using either inline or separated css to style the link. you could set background color, border, text styles, etc., to mimic a "button" quite closely.

for javascript, you would do this, even though i don't condone it:

Code:
<input type="button" value="Click Me" onclick="window.location=[URL unfurl="true"]http://www.google.com/"[/URL] />

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Thanks.

Setting the window.location property seems to work fine. Why do you say you don't condone it though? What kind of problems can this cause?
 
problems will occur when people have disabled javascript in their browser. For these users, when they click the button, nothing will happen. This can be quite frustrating, as I'm sure you can imagine.

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Ahhh... Just like you said in your first response a few minutes ago. Should have paid closer attention.

This is just for a mockup I am doing on my machine, so I'm good to go using the javascript.

Thanks again for the info.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top