User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 456,234 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,762 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1293 | Replies: 3 | Solved
Reply
Join Date: Sep 2005
Location: St. Louis
Posts: 145
Reputation: kahaj is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
kahaj kahaj is offline Offline
Junior Poster

Button Link

  #1  
Nov 13th, 2007
How do I insert a link to another page to the pressing of a button? I'm assuming it would be via the onclick event, but can't seem to get it accomplished in a manner which will actually work.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2007
Location: Brisbane, Australia
Posts: 215
Reputation: sillyboy is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 13
sillyboy's Avatar
sillyboy sillyboy is offline Offline
Posting Whiz in Training

Re: Button Link

  #2  
Nov 13th, 2007
Originally Posted by kahaj View Post
I'm assuming it would be via the onclick event


Have you tried:

window.location = "???.html";
Reply With Quote  
Join Date: Sep 2005
Location: St. Louis
Posts: 145
Reputation: kahaj is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
kahaj kahaj is offline Offline
Junior Poster

Re: Button Link

  #3  
Nov 14th, 2007
Alright, thanks!
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,012
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 368
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: Button Link

  #4  
Nov 15th, 2007
Though that works, it's an incorrect way of doing things.

The location property of the global object window is an object and not a string. What you need to do here is set the href attribute or property of the location object. And BTW, no need to prepend it with window since it is implied.

location.href = 'http://www.google.com/';
And come to think of it, there is no need to drag javascript into this. You can do this with simple HTML assuming you don't need to dynamically generate the link.

<a href="http://www.google.com/"><input type="button" value="Go!!" /></a>
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 5:07 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC