Guest Alex Richardson Posted November 21, 2007 Share Posted November 21, 2007 I am trying to make a button behave like an anchor. When I click the button I navigate to a new page. My first geuss would be to use some javascript, something like window.open(...). All of those open new windows. I need the new page to be opened in the same spot. Any suggestions? Link to comment Share on other sites More sharing options...
Ingolme Posted November 21, 2007 Share Posted November 21, 2007 <input type="button" onclick="window.location.href = 'URL'" value="Click here" /> Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted November 22, 2007 Share Posted November 22, 2007 Instead you could use <input type="button" onClick="java script:top.location.replace("URL") value="Click here" /> The top.location.replace tends to work more in versions of IE and FF. Link to comment Share on other sites More sharing options...
Ingolme Posted November 22, 2007 Share Posted November 22, 2007 location is just a property of the window, according to W3C standards.And since when the capital C in "onclick"? Link to comment Share on other sites More sharing options...
Synook Posted November 22, 2007 Share Posted November 22, 2007 location is just a property of the window, according to W3C standards.The top object refers to the topmost frame, but in this case that would be synonymous with the window object.And since when the capital C in "onclick"?In HTML event attributes can use lowerCamelcase. Not in XHTML though. Link to comment Share on other sites More sharing options...
Reg Edit Posted November 22, 2007 Share Posted November 22, 2007 Instead you could use<input type="button" onClick="java script:top.location.replace("URL") value="Click here" /> The top.location.replace tends to work more in versions of IE and FF. Actually the replace method loads the specified URL over the current history entry. After calling the replace method, the user cannot navigate to the previous URL by using browser's Back button. That may not be the intent in this case. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.