Click to See Complete Forum and Search --> : One Tag To Open Every Link In A New Window?
Detacht69
06-05-2006, 06:06 AM
I'm asking about my Myspace account. I'd like to know if there's one piece of code
that i can put in that will allow all links clicked from my site to open and load in a new page.
Thanx in advance.
ChiefNX
06-05-2006, 06:20 AM
Sure
<a href="http://www.link.com" target"_blank">Link</a>
Detacht69
06-05-2006, 06:23 AM
Well I know about that... but i'm trying to keep from not putting that behind every single link...
In other words isn't there something that would say links 1 2 3 4 & 5 will open in new windows when
1
2
pic
3
text
4
5
because i can't control all the html on my page... if someone clicks on someone else's profile from mine, it'll open in the same window, and i'm trying to change that
Charles
06-05-2006, 07:04 AM
Sure, there's lots of ways to do this.
Do you want all of the links to open in a new window?
If so, can you edit the document's HEAD element.
If not, are they all in one section?
Detacht69
06-05-2006, 07:09 AM
Yes, that's what i'm trying to accomplish... ALL THE LINKS
Except the catch is, it's myspace so i don't have complete control over all the html. I am able to change the way it looks by adding this code to a section, and i want to add something to open a new window evertime any and every link is clicked... maybe i'm dreaming
<Style type="text/css"> body{ background-color:333333; } Table, Td{ background-color:transparent; } body, div, p, strong, td, .text, .blacktext10, .blacktext12, a.searchlinkSmall, a.searchlinkSmall:link, a.searchlinkSmall:visited{ color:FFFFFF; font-size:10pt; font-weight:bold; font-style:italic ; font-family:Arial, verdana, arial, sans-serif; } </Style>
Charles
06-05-2006, 07:19 AM
Well if you can add a STYLE element to the HEAD then you should be able to add a BASE element.<base target="_blank">Otherwise you might try a little JavaScript.<script type="text/javascript">
onload = function () {
var l, i = 0
while (l = document.links[i++]) {
l.onclick = function () {window.open (this.href, 'child'); return false}
}
}
</script>
Detacht69
06-05-2006, 07:26 AM
Oh man that so totally almost works thanx a lot!!
it works on all the links except when people go to click my pic for more pics
the tree
06-05-2006, 08:00 AM
Funny that, it looks like a regular link. I think you've reached the point where you have to accept that myspace is screwy and not everything is going to work the way you want it to.