473,657 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Javascript to add target attribute to links

Hi,

I have a page which is being generated by a CMS and I can't control
the links which are being outputted. I want to add a target =
"_parent" attribute to all the links on my page using javascript. Can
anyone tell me how to do it.

Thanks a lot.

Gerald.

Feb 19 '07 #1
1 6031
Gerald Shastri wrote:
Hi,

I have a page which is being generated by a CMS and I can't control
the links which are being outputted. I want to add a target =
"_parent" attribute to all the links on my page using javascript. Can
anyone tell me how to do it.

Thanks a lot.

Gerald.
links=document. getElementsByTa gName("a");
for(var i=0; i<links.length ; i++) {
links[i].target="_paren t";
}
--
http://www.hunlock.com -- Musings in Javascript, CSS.
$FA
Feb 19 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2298
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I need to: 1. Click a submit button on an asp page, calling another page that saves the contents of that form to a database and then displays
16
12283
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 :
9
5522
by: Muffinman | last post by:
Hi, I have a webpage with two Iframe's. I want to be able to change the target of all links in one frame so it will point to the other frame and all this from the main page. Is this possible and if so how? Thanks in advance, Maarten
36
3960
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...
2
1554
by: mahsa | last post by:
hi how can I open this link in new pop up window using javascript? <asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink> -- mahsa
3
2088
by: jblossom | last post by:
Hello, I'm in a quandary as to how to address a problem. The site in question: http://agapeyoga.com On the left-hand side of the site are image navigation elements that change when clicked based on where you are in the navigation heirarchy. They work just fine in IE, but Firefox doesn't load the initial state of the images. If you mouse over the images that have onmouseover or
6
12071
by: bushi | last post by:
hi everyone! i have diplayed my hyperlinks in a iframe.when i redirect to next page.the next page also open in the same frame,but i want to open a new browser window,when i click on the link.actually i 'm using link button control to diplay the hyperlinks.i cant use java script "window.open()".i need some server side code behind the linkbutton,if any one knows plz rply soon.
3
7355
by: akristensen | last post by:
I am new to this site, so be patient if I do not ask the question correctly. Current Target Platform: Browser: MS IE, script language: Javascript (will use VBScript, but JS is preferred), External apps: MS Excel What I need to do: From a web page using javascript, I open a new Excel application and sheet, populate some information into it. After it is populated with some information, I need to run the "Solver..." option on the data in the...
1
1555
by: jmcgranahan | last post by:
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...
0
8425
marktang
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...
0
8326
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,...
0
8845
Oralloy
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...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7355
agi2029
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...
0
5647
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();...
0
4173
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...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.