First, a disclaimer: I am a librarian by trade, but have the responsibility of maintaining/updating our online catalog. I've dealt with some JavaScript before, but I am no expert, so please forgive my ignorance.
Question: Our automation system creates information dynamically for us. 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. My theory is that if I can get this attribute changed to _blank, it might work, but I haven't figured out a way to do this. I have tried the following: - <script type="text/javascript">
-
/ * Checks for target attribute in link tags. */
-
var f=window.document.links;
-
var i=f.length
-
while(i--){
-
f[i].target='_blank'
-
}
-
</script>
-
(the above was modified from another posting on this forum)
However, this does not seem to work because the link is still going to the _self target. Any suggestions would be greatly appreciated. Thank you!
Jamen McGranahan
1 1554
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="messWit hAnchors( '_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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Dietmar Gräbner |
last post by:
Hi
Right now I'm dealing with derivation by restriction and I have some
questions concerning the attribute property use in context of the
derivation.
Consider following Schema:
<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
by: Mike |
last post by:
Hello
How do i get around target="_blank" is not allowed in xtml strict?
Thanks
Mike
|
by: Mark van Ballegooijen |
last post by:
When using the XHTML 1.0 validator at http://validator.w3.org/check, an
error will be raised for every instance of a "target" attribute in "A"
elements. Is it truely because it is not part of this specification
anymore, or is it an error in the SGML parser ? Any alternatives ?
html code :
<a href="./page.html" class="pagelink" target="_self">some text</a>
used doctype :
|
by: randau |
last post by:
I would like to use the Link Target attribute, but am
inhibited by the likelihood of a newly opened browser window
completely hiding the Parent browser window. Thus offering
the illusion that you're still in the same browser, but the
Back Button no longer works.
I've done some experimentation and came up with the
conclusion that Microsoft's IE browser has a relatively
small likelihood of that happening, but that Netscape's
browsers...
|
by: ESPNSTI |
last post by:
Hi, I'm very new to C# and .Net, I've been working with it for about a month.
My experience has been mainly with Delphi 5 (not .Net).
What I'm looking for is for a shortcut way to override a property without actually having to reimplement the get and set methods.
In other words, override the the property without changing the functionality of the base property and without explicitly having to reimplement the get and set methods to make it do...
| |
by: Joe |
last post by:
I have a web.sitemap file that has the url title and description. I then
have this attac attached to a menu. I want some of my menu choices to open
up in a page in a new window ie _blank as target. How do I do this with a
web.sitemap file
|
by: Raja Raman Sundararajan |
last post by:
Hello guys,
I have data stored in the database which has special characters
like <, etc.
Case 1: Whenever I wanted to present the output to a browser
I need to escape these special characters into the browser
equivalent like < > etc.( for example by using the cgi module)
Case 2: Whenever I wanted to present the output to some client other
than a browser, I wanted to present the data as it is stored in the
database.
|
by: r035198x |
last post by:
The Object class has five non final methods namely equals, hashCode, toString, clone, and finalize.
These were designed to be overridden according to specific general contracts. Other classes that make use of these methods assume that the methods obey these contracts so it is necessary to ensure that if your classes override these methods, they do so correctly.
In this article I'll take a look at the equals and hashCode methods.
...
|
by: Erwin Moller |
last post by:
Hi group,
I encoutered page validation error, but I don't know a way around.
The page has the following doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
Some hyperlinks need to open to a new window, so I used the (wrong)
target="" attribute.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |