please forgive my ignorance.
Forgiven!
Question: Our automation system creates information dynamically for us.
You're talking server-side scripting -- like ASP or PHP? Or is this more of like a batch program to roll up a database into static html files?
In one particular area of our page, it is adding a target=_self attribute that I believe is causing problems with our attempt at making a tab display.
Please elaborate on "tab display"
My theory is that if I can get this attribute changed to _blank, it might work,
target is generally used with framesets -- if you have multiple frames, setting the "target" on an anchor will make the link open up in that frame... _blank usually means new page, _top means at the top level, above all the frames ... and most anything else -- i think, not sure -- if not found, the browser will open a new window and reference it by that name.
"target" has been depricated in html4.01 strict.
but I haven't figured out a way to do this. I have tried the following:
-
/ * Checks for target attribute in link tags. */
-
var f=window.document.links;
-
var i=f.length
-
while(i--){
-
f[i].target='_blank'
-
}
-
*winces* -- that'll set 'em all... or raise an error... or something... try this:
[html]<body onLoad="messWithAnchors( '_blank', '_self' )">[/html]
-
function messWithAnchors( _incomingTarget, _outgoingTarget ) {
-
var a = document.getElementsByTagName("A");
-
for(x=0;x<a.length;x++) {
-
if ( a[x].getAttribute( "target") == _incomingTarget ) {
-
a[x].setAttribute("target", _outgoingTarget );
-
}
-
-
// test function to verify the target was set properly
-
// a[x].onclick = function() { alert(this.target); }
-
}
-
}
-
but anyway... back to my first question, if this is being generated automatically somehow, it would be WAY easier and more efficient to change the root source than it would be to wait for the document to load and change all the anchors' targets via javascript.