redho home | products | services
Web Design Forums

Web Design Forums  


Web Hosting, Web Design, Software and Web Development Forums  
 FAQFAQ   MemberlistArchive  Log inLog in   RegisterRegister 
         

how do i follow the link from js


Goto page 1, 2  Next
 
Post new topic   Reply to topic    Web Design Forums -> JavaScript forum
View previous topic :: View next topic  
Author Message
autos06



Joined: 13 May 2006
Posts: 123
Location: New York
G'day.
From Javascript, how do I follow a link?
Say I can grab the link using document.getElementById() how do I click on it?
  Reply with quote


optomeb



Joined: 19 May 2006
Posts: 113
.click()
  Reply with quote
autos06



Joined: 13 May 2006
Posts: 123
Location: New York
Excellent
  Reply with quote
kadamat



Joined: 01 Jun 2006
Posts: 88
Ikopar, are you sure?
I'm using firebug, and I can grab the element, but it doesn't have a click() method
  Reply with quote
Ikopar



Joined: 26 May 2006
Posts: 168
Well it depends on the UA
The other option is to get the location and manually change to it
  Reply with quote
kadamat



Joined: 01 Jun 2006
Posts: 88
Document.getElementsByTagName('a')[0].click is undefined.
But that returns <a href="/home/"
Using firefox
That's the only UA i need to support
  Reply with quote
Ikopar



Joined: 26 May 2006
Posts: 168
So location=el.href; job done
  Reply with quote
kadamat



Joined: 01 Jun 2006
Posts: 88
Ikopar: but it's a relative url, does that work?
  Reply with quote
Ikopar



Joined: 26 May 2006
Posts: 168
Sure
It won't with base href in there
But otherwise
  Reply with quote
kadamat



Joined: 01 Jun 2006
Posts: 88
How would I go about getting the base href?
  Reply with quote
Page 1 of 2 Goto page 1, 2  Next
Post new topic   Reply to topic    Web Design Forums -> JavaScript forum


Dubai Forums - Expat Help | Vegan Chat | Java Programming | Free 3D tutorials and 3d textures | Paris Forum | EU Forum
Free Dubai Classifieds | Free London Classifieds | Jobs in London

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

Powered by phpBB © 2001, 2005 phpBB Group