Adding A Class To All Links With A Target Of _blank
Jun 26, 2010adding a class to all links with a target of _blank
View 12 Repliesadding a class to all links with a target of _blank
View 12 RepliesI need to add [target="_blank"] to the code below but I can't figure it out.
[Code]..
I am using the following javascript on the target page to open it as top location from within an iframe, which is working ok.
<script type="text/javascript">
if(self!=top) {
top.location.href=location.href
}
</script>
However my problem occurs when the user uses the browsers back arrow to return to the previous page, the script executes again returning them once more to the page they have come from. Is anyone aware of a work around to this problem as it would seem there isn't one? perhaps even a better solution for opening the target page from the iframe as top location. This is really causing confusion for users, and I really need to get the issue fixed.
i am doing an fprotate.class pictures and for the click link i'm trying to
get it to open in a new window. here's my command line and it opens in the
exisiting window:
<param name="url" valuetype="ref" value="http://www.mywebsite.com">
anyone have know what script text i put in to get hte page to open in a NEW
window similiar to the html [target="_blank"]
Code:
<a href="#" onclick="window.location='http://YourSite.com'">click here</a>
I want to make it so that it opens a new normal browser window just like target=_blank does.
[Code]...
And i need edit this code that it open the links in select to _blank not to a new window
i have a little problem with the target attribute ine the form below...
Code:
<form id="formReport" action="<?php echo $reportlink;?>" method="post" target="_blank">
<input type="hidden" name="reportProject" value="1">
<input type="hidden" name="idProjectRevision" value="<?php echo $idProjetRevision; ?>">
<input type="hidden" name="generateButton" value="<?php echo $bouton_generate_report; ?>" >
</form>
this form is submitted using the following .js code in order to generate a pdf Code: document.getElementById("formReport").submit(); the problem is that i get a popup (blocked by firfox by the way) instead of a new window or a tab, how do i solve this?
I am using a JavaScript to add a 'blank' target to any links that have 'external' specified in the REL. This is working great, but on some of the links, I need to give the user the ability to click the surrounding <li> item as well.
So my regular link looks like this:
<li><a rel="external" href="http://www.google.com">Google</a></li>
I need to figure out how to add the REL to the onclick in the LI
<li onclick="location.href='http://www.google.com/';"><a rel="external" href="http://www.google.com">Google</a></li>
[Code]...
I can't seem to find any instructions about how to insert this REL option....
I'm trying to parse my anchor tags, by getting all the href attribute available in the page, and then i will loop through this attribute values and then parse it. if each href value is equal to "mypage.com", the link will open to the same window, but if not it will open to a new window, more like the concept of determining internal and external links in a page.
View 6 Replies View Relatedadding var target to this form action Would This be correct?
var form = inp.form;
form.target = "_self";
<html>
</head>
[code]....
Code: window.location but have it open in new browser window (like with target="_blank", not window.open)
View 7 Replies View RelatedI want to disable/enable all links with a class of 'modal' code...
View 3 Replies View RelatedIm trying to get the class of the clicked link when the below function is run, i need the variable "videoID" to be the class of the clicked link.
Heres my javascript attempt:
Code:
And my html
HTML Code:
Trying to figure out how to use javascript to extract all links on a page that have a certain class:
e.g. - extract only links with a class of 'tools', ignore all other links:
<a href="http://www.google.com" class="tools">Search</a>
<a href="http://www.tripod.com" class="grapes">Searched</a>
<a href="http://www.dogpile.com">Searches</a>
I'm guessing I probably have to use something like getelementbyclass("tools")?
On my website, I have random logos appear on the home page as products that I recommend. I would like to make these logos into links to the website they are from, so that when one clicks on the picture, it directs you to the site, but I can't quite get it to work, and I know very little about Javascript (as you may know from my previous question about Javascript).
Here's my current JS code:
<!--
// Set up the image files to be used.
var theImages = new Array() // do not change this
// To add more image files, continue with the
[Code].....
I have a random image JS that I need to add links to ( well, the same link but to all images) something I am doing is not working. I just need to add a link (asp/course_tool/default.asp) to each jpeg. Code:
View 2 Replies View RelatedI have a web page wich has several list like this one:
So several ul's list wich are inside severals divs of class <div class="languages_cont" >
I need to make active the first <a> of each one this ul's and it need to be done in Js (when i say active i mean the <a> text will become bolded, so right now i've been trying using a each but no luck yet, it only selects the first it encounters.
I have three links that call three functions that change a div. Now, I want to change links color when active. I made this so:
var act = "";
function doActive(obj){
obj.className='active';
if(act != undefined && obj != act){
act.className = 'off';
[Code]...
I found a jquery image slideshow script but the images have no links to them. When I manually add the links to the image urls, these work only in IE - when I click next, the picture updates and is linked to the correct URL. In other browsers (Firefox, Chrome..), the last url becomes the clickable link for all the images. I have tried to use the .wrap option and I'm sure I'm on the right track, except I have 4 images and I want it to go to 4 different urls.it sought of works, but only the first url is picked up and becomes the link for all the images.How can I get the link reference for the url to iterate with the original loop of the image?
View 2 Replies View RelatedI've got this little chunk of code running on my freelance portfolio site - on each page (different sections of my portfolio) I have 6 thumbnails and a full sized graphic with some descriptive info, you click the thumbnail and it switches the graphic and other info, that all works fine.But on one page I have some web stuff and I'd like to make the var 'clientinfo' into a link to go to the client's website. I know I need to add an array with the website links, but then I'm not sure how to implement it into the html, I've tried various things I've found on here but I'm not getting anywhere on my own. I know it's something pretty simple (for someone who knows what they're doing) but I just can't seem to grasp it.
the js is like this:
$(function() {
$(".image").click(function() {
[code]....
I know you can add classes with DOM, but specifically what I want to do is when a link is clicked I want to add a class that will style it as being "active" since a:active only lasts for the moment it is clicked. Basically I would want something like this:
One of the links will default to "active"
<a href="#" class="active">Link 1</a> | <a href="#">Link 2</a> | <a href="#">Link 3</a>
Then when another link is clicked the class would be removed from Link 1 and added to the clicked link
HTML Code:
<a href="#">Link 1</a> | <a href="#" class="active">Link 2</a> | <a href="#">Link 3</a>
Hope this makes sense.
How can i add a function to all links which share a same class on page read? I want to add this addClassSub(); to all the links with a class name 'sub'.
this is the html,
[Code].....
adding a class to an active li. I'm working in drupal, and the system adds a .active class to the DOM of whatever li class was last selected.In my .js file I added the following:
$('document').ready(function(){
var tabActive = $('#tabs-tabset ul.primary li.active a');
tabActive.addClass('tabknotch')
});
This works perfectly...for the first tab. when I navigate to the next tab the class does not change. I thought maybe there's a variable in the dom that is causing the class to not move, so I tried narrowing the div that it looks for and tried this:
$('document').ready(function(){
var tabActive = $('li.active a');
tabActive.addClass('tabknotch')
});
This achieved the exact same results...so there's obviously something I'm missing, but don't know what it is. If it's any help, here are two examples of the generated DOM that occurs when clicking on the active li. The first example is the div that has the class added, and the second is a div that does not have anything added. <li class="overview ui-tabs-selected active first tabknotch"><a href="#overview"><span class="tab">Overview</span></a></li> (this is the active tab where the jQuery succesfully adds the "tabknotch" class)<li class="features ui-tabs-selected active"><a href="#features"><span class="tab">Features</span></a></li> (this is the active tab that does not have the class added when clicked. When this li is active knotchtab remains on the other li that no longer has the .active class attributed)
I have a single page website and I would like to add an .active class to my links when I reach a certain point on the page (this will be done by unique div or section id's). The classes are currently empty, so I would need to be able to remove and replace the .active class accordingly.
Here is my html:
<
nav
id="main-nav">
[code]....
I would like to create a mouseOver event that adds an attribute to a class, so that this...
...ends up like this:
I know you can use css, i have tried already....I need a unique selector name.
I tried the following...
...but on mouseover, instead of the selector being replaced, the text "Something" is replaced by "1plus" in the resulting html.
I am rather new to jQuery, and have been trying to work out how to add info to a class, but so far following various tutorials hasn't worked.
I have a span with the class TT marked (<span class="TT">xxx</span>).
I need to add the following code to it: