PDA

View Full Version : Herf from getElementById



cbiblis
02-01-2011, 04:20 PM
I've spent three days trying to figure this out without any luck.
What i am attemping to do is to open an unframed tab using the link from a frame id. I want to be able to enter a js command in the browser on the page then have it open in a new tab unframed or just reload the link unframed. These are the commands i have tried in my browser:


javascript:<a herf="document.getElementById("netlinkx").childNodes[1].src;">

javascript:<a herf="window.location.href=document.getElementById("netlinkx").childNodes[1].src;">

javascript:<a herf=document.getElementById("netlinkx").children[0]>.setAttribute('id','this_one');alert(getFrame("this_one").body.innerHTML);>

and a few others that didn't work.

Kor
02-01-2011, 04:27 PM
Try:


<a href="#" onclick="location.href=document.getElementById('netlinkx').contentWindow.location.href;return false">

cbiblis
02-01-2011, 04:54 PM
Thanks for the quick reply however its still not doing anything. i am using firefox and this is what i pasted in the address bar of the browser when on the page.

javascript:<a href="#" onclick="location.href=document.getElementById('netlinkx').contentWindow.location.href;return false">

Am i using it properly, putting the "javascript:" in front of the command?

Kor
02-01-2011, 04:56 PM
javascript:<a href="#" onclick="location.href=document.getElementById('netlinkx').contentWindow.location.href;return false">
What is that? My code was not a command, was a link, a HTML A element:


<a href="#" onclick="location.href=document.getElementById('netlinkx').contentWindow.location.href;return false">Click me</a>

cbiblis
02-01-2011, 05:04 PM
i am wanting to past something into my firefox browser address bar. am i suppose to make a script to run with the <a>url ? Sorry, i'm a newby.

Kor
02-01-2011, 05:09 PM
If you want to write that in the address bar, type this there:


javascript:location.href=document.getElementById('netlinkx').contentWindow.location.href

But why in the address bar?

cbiblis
02-01-2011, 05:12 PM
i'm on a page that junk keeps scrolling around and interferes with my concentration. so i just want to open the url from the id into a unframed tab so i can just look at what i there for.

cbiblis
02-01-2011, 05:15 PM
basically, i want to make a bookmark button that when i get to the page i just click it and all the other junk goes away.

cbiblis
02-01-2011, 05:22 PM
i just took javascript:location.href=document.getElementById('netlinkx').contentWindow.location.href and made a bookmark for it. when i'm on the page and i click on the bookmark button. nothing happends. i have javascript enabled. is there something else i can check on my end to fix why this isn't working?

Krupski
02-01-2011, 08:21 PM
basically, i want to make a bookmark button that when i get to the page i just click it and all the other junk goes away.

Try the herf powerswitch? That makes annoying screen content go away. http://three-dog.homelinux.com/phpbb/images/smilies/laughingtohard.gif

(sorry just couldn't help it)