web hosting and development forums
Web Design and Development Forums Archive


Index - JavaScript forum

how do i follow the link from js


Post reply

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?
.click()
Excellent
Ikopar, are you sure? I'm using firebug, and I can grab the element, but it doesn't have a click() method
Well it depends on the UA The other option is to get the location and manually change to it
Document.getElementsByTagName('a')[0].click is undefined.
But that returns <a href="/home/"
Using firefox
That's the only UA i need to support
So location=el.href; job done
Ikopar: but it's a relative url, does that work?
Sure It won't with base href in there But otherwise
How would I go about getting the base href?
With the DOM getting the base element
Ikopar, I don't understand.




Dubai Forum | Paris Forum | Webmaster Forum | Vegan Forum | Brisbane Forum | 3D Forum | Jobs in Dubai | Jobs in London | London UK Classifieds
Archive script by RedHo.com