Change Link Color With .className

Feb 19, 2009

I am using some code I found on the internet to make all my external links in a new window. Also, I want to make these links gray. I think I once heard you coulden't change link colors at all once a page was loaded, but I may be wrong. In any case, it won't work.

Here is my code:

Now I find I can't make them open in a new window either.

View 1 Replies


ADVERTISEMENT

Change The Color Of A Link After It Has Been Clicked On WITHOUT Using CSS

Aug 22, 2009

I am trying to change the color of a link after it has been clicked on WITHOUT using CSS.

When the link is clicked some javascript is called. I can do this in IE by adding this "this.style.color = 'black'". However this doesn't work in other browsers. Anyone know how I could get this to work in other browsers?

View 2 Replies View Related

Change Color Of Link Depending Whether It - A Certain Value

Jul 8, 2009

I am trying to create a list of customers that we do weekly reports for. What I would like to do is if the current date falls in between $date (variable of last updated report) and $date+7 (i.e. a week later) then display the text in green else display text in red.

View 1 Replies View Related

JQuery :: Change Link Color On Click?

Oct 4, 2011

I've got 2 scripts for my website. The first is an AJAX script which loads the different pages when the links are clicked. The second scriptfades content in and out on the home page when another set of links are in.

I'm struggling to change the color of both sets of links when they're clicked.

Here's the code:

$(document).ready(function() {
//AJAX: loading contens of pages
var hash = window.location.hash.substr(1);
var href = $('#nav li a').each(function(){

[Code].....

View 2 Replies View Related

Onclick Link Change Text Color ?

Aug 11, 2011

I have a page here [url]. What I want to control is that for link on the left that is clicked I want the text to change to a particular color to highlighted it have been selected. And when another linked is clicked I want the previous linked to be reset to the normal color. How to achieve that.

View 2 Replies View Related

Onclick Link Change Text Color

Aug 11, 2011

I have a page here [url]. What I want to control is that for link on the left that is clicked I want the text to change to a particular color to highlighted it have been selected. And when another linked is clicked I want the previous linked to be reset to the normal color.

View 4 Replies View Related

Change Active Link Color On Div Swap

Mar 19, 2011

I've been able to develop the content div swap for the following test site, [url], but can't figure out how to highlight the active name in the left-hand sub-navigation.

Here's the code...

HTML Code:

View 2 Replies View Related

Change The Background-color Of The Link Onclick?

Oct 11, 2011

l have got a series of menus. What l want to do is change the background-color of the link onclick.

What l have done use jquery like this

jQuery('.menu a').click(function(){
var clz = jQuery(this).attr('id');
jQuery(this).attr('class','active'+clz);
})

This is not work.The code needs to work on mobile phones

View 3 Replies View Related

Change Text Color Of A Link With Onclick Event

Jul 20, 2005

I created 3 hyperlinks, when the user click each link, it will change
the color of the text of a link. For example, when user clicks Link1,
text Link1 will become red color, but Link2 and Link3 unchange. Here's
my attempts, any ideas??

<script language="javascript">
function changecolor (i)
{
document.i.fontcolor = red;
}
</script></head><a name="item1" href="test.html"
onClick='changecolor(item1)'>Link 1</a><a name="item2"
href="test.html" onclick='changecolor(item2)'>Link 2</a><a
name="item3" href="test.html" onclick='changecolor(item3)'>Link 3</a>

View 5 Replies View Related

JQuery :: Change Current Link Opacity And Color

Oct 18, 2011

I've got this script which effectively should change the clicked link's opacity to full and its siblings' opacity to 0.6. The only part that works though is the changing the text color to black. Here's the script:

<script type="text/javascript">
$(document).ready(function(){ $(".menu a").live('click',function(){
$(this).siblings().css('color','red');
$(this).css('color','black');
$(this).css('opacity',1);
[Code]....

View 3 Replies View Related

JQuery :: Hover Doesn't Work When Change The Text Color Of A Link?

Sep 11, 2011

I have a simple menu as you can see in which i want the link that gets pressed to change color to grey.(line26).But before that (line25) i use jquery to change all the links back to their original color.But that line of code destroys my hover effect on all my links for a reason.

<head>
<style>
.link {
color: #fff;

[Code].....

View 3 Replies View Related

Show / Hide Div Layer / Change Link Color / When Radio Button Is Selected

Aug 16, 2010

I am trying to develop an exam system.Find my code below.I request you to copy the code and save it as an html file .I have 2 problems:

1. Kindly notice that when the quiz is loaded,it shows both the questions by default.I want only question 1 to be visible when the quiz loads.What happens presently is that ,both questions are visible even after I click on the link
Q.1( referring to question 1).However,when I click on
Q. 2,then only question 2 can be seen and then(after clicking on Q.2) if I click on Q.1,then only question 1 can be seen

What I want is that when the page loads only question 1 is visible.Then when I click on Q.2,I can see only question 2 and when I click on Q.1, I can see only question 1.I later plan on adding many questions,so it should be a general solution rather than a solution good only for 2 questions.

2.Also,what I want is that,if someone selects any of the answers of a particular question,it's link color should turn green to indicate to the user that he answered that question.So for,instance,if I select an answer to the first question(select one of London,New York,Seattle,Washington,Chicago), the link Q.1 should turn green.

View 3 Replies View Related

JQuery :: Classname Of Link Not Toggle Between Plus And Minus

May 10, 2010

I've just recently become enlightened by jQuery and would like to add it to my site, but I'm having a little trouble. I made this basic function:
function showPanel(id) {
var panel = $(".further_info." + id + "");
panel.slideToggle();
$(this).toggleClass("minus");
$(this).toggleClass("plus");
}

To give an example of its use:
<a class="panel_control plus" onclick="showPanel(0);"></a> <div class="further_info 0"></div>
The panel is displayed correctly, but the classname of the link isn't toggled between "plus" and "minus."

View 2 Replies View Related

ClassName Change Not Working

May 29, 2006

I was just battling a small dHTML quirk where I was attempting to set
the className attribute of option elements, but it didn't seem to be
updating. I did some testing with other elements and came to find the
problem was not in my code at all, but rather in my logic...

I had a dehighlightAll(selectBox) function in my code library and
decided to use this to reset all the options to white backgrounds.
This worked fine with my previous method where I explicitly set the
style.background attribute of the options. But when I wanted to use
className instead, everything mysteriously stopped working. I thought
there must be something wrong with className and started
investigating....

I eventually came to the realization that if you explicitly set a style
element, it won't be overridden by the className. This was an
oversight on my part and thought that it might be useful to post about
it, because it could be easy to miss and I haven't seen any posts about
it.

It really comes down to the CSS order of precedence ... that is the
style field modifies the inline style of the object, while the
className references a class ... and as CSS precedence dictates, inline
styles override all others. So this is a word to the wise to be
careful if you're ever mixing className and style elements...

View 1 Replies View Related

Change The Classname Of All Of The Tabs With A Function

Jan 14, 2009

I'm trying to change the classname of all of the tabs with a function.

Here's the code:

Code:

The script doesn't work at all.

View 3 Replies View Related

JQuery :: Style Link Color With A Variable For Random Color Attached?

Dec 5, 2011

I want to 'style' all links on my site with a variable for random colors. I got the variable for the random colors up and running but i can't figure out how to implement the variable to the css.

View 1 Replies View Related

JQuery :: Bizarre Behavior Caused By $('.classname').change() On Multiple <select>

Dec 15, 2010

I have a series of paired <select> objects. By paired I mean the <option> values of one is dependent on the state of the other via an ajax call. Something like:

[Cdoe]..

Here's where the bizarre behavior happens. If I trigger a change event for "primary" classes, i.e. $('.primary').change(), only the LAST "secondary" gets changed. For the list above only $('#number_six') would be dynamically filled. I tried using $('.primary').each(function(){ blah }) instead but got the same result. I read somewhere that some change events are only registered when the object is no longer in focus, so I tried adding .blur() to the end of the statement.

View 1 Replies View Related

JQuery :: AddClass - Change The Color Of Surrounding Text Of The Disabled Radio Button To The Color Grey

Feb 8, 2010

I have this markup:

[Code]...

There are two radio buttons, sometimes one will be disabled, other times the other will be disabled. I would like to make a script that: First: Changes the color of surrounding text of the disabled radio button to the color grey. Second: Checks the other radio button.

This was my plan: I would make a script that: First: Removes all the current classes and add the class "greyed_out" (or better: change only the color of) the parent element, all siblings and children of siblings (if any) of the radio button that is disabled at that time.Second: Sets the attribute "checked to the other radio button". I made a script, but when I set the bottom radio button to disabled the script doesn't work:

[Code]...

View 4 Replies View Related

Additional Color Array For Background Color Change On Mouseover

Apr 24, 2011

have been trying to rework this to call additional, independent sets of colors to cycle through (so it would loop thru a set of grays, a set of primary colors, etc). I would use perhaps a different function name in the HTML to call different sets of colors. If this is more complex than I think it is, I think 3 sets would be plenty. demo link of script in current state at bottom)

<html><head><title></title>
<script language=javascript>
colors = ["#cacdca", "#b2b4b2", "#969896", "#7d7f7d", "#ffff00"];
cRGB = [];

[Code]....

View 7 Replies View Related

Change Background Color And Font Color?

Feb 11, 2009

I have a form which contains FOUR text fields (e.g. TEXTFIELD1, TEXTFIELD2, TEXTFIELD3 & TEXTFIELD4). Each text field holds a HEX,DEC color value. ABOVE this form I have a table with TWO ROWS (ROW1 and ROW2). ROW1 should correspond with TEXTFIELD1, so that when the VALUE in TEXTFEILD1 is changed the background color of ROW1 will change to match the HEX,DEC VALUE entered in TEXTFIELD1. The same would happen with TEXTFIELD2 and ROW2. TEXTFIELD3 should be used to change the color of the TEXT inside ROW1 and TEXTFIELD4 should change the color of the TEXT in ROW2. I also wanted to know if it would be possible to achieve this without clicking any button.

------------------------------------------------------------------
| ROW1 | TEXT IN ROW 1
------------------------------------------------------------------
| ROW2 | TEXT IN ROW 2
------------------------------------------------------------------

TEXTFIELD1 <----HEXDEC VALUE GOES HERE to change color of ROW1---->[code]....

View 9 Replies View Related

Jquery :: Link Color Only Changes On Focus Link?

Jan 22, 2010

i want the link only to change color when clicked and content changes in window "#gallery". Then when click on another link, it goes back to original color and new link is now changed. Basically, only when link is acitve or focused on then it's new color so user knows link and content that's being viewed.

View 2 Replies View Related

Code To Just Underline Linked Text To A Certain Color (red) But Doesn't Change The Text Color?

Mar 26, 2009

Is there code to just underline linked text to a certain color (red) but doesn't change the text color (it was white & when hovered over, it still stays white with a red underline)?

View 4 Replies View Related

Change Text Color For One Document.write But Not Color Of All Text?

Jul 23, 2005

I want to make the date at the top right darker blue. But when I do that, all the light blue text next to the pictures also changes.

How can I control the color of the result of document.write output without changing the forground color of the entire page? Note my document write includes variables, so I was hesitant to imbed an html command in the document.write.

View 7 Replies View Related

Button Colors Flipfloping - Change From One Color To Another When Click Them And Change Back When Click Them A Third Time

Feb 12, 2010

I'm trying to make buttons that change from one color to another when you click them and change back when you click them a third time. I wrote this page (http://cf.lehigh.edu/ems/test.html) but it only works on Firefox(Not IE or Chome, untested on safari or Opera). I'm using javascript to change the button colors. Is there another way to do this that works universal or another tool such as CSS?

[Code]....

View 1 Replies View Related

JQuery :: Get The Hover Color Of A Link?

Aug 24, 2009

I need to get the css hover color of an element. Since hover is a pseudo class of a class or id, I do not see a way of returning the color. I tried: $('.contentArea a:hover').css('color'); but it does not return the hover color. I understand that jQuery probably traverses the inline styles and there is no way to set the hover pseudo class inline, hence the reason for the .hover function. Is it possible to find and return the hover color with jQuery. If so how?

View 3 Replies View Related

Changing CSS Link Color Attribute

Dec 8, 2010

I'm a member of a forum the for the Winter season has changed it's CSS a:link color attribute to a more winter themed colour. However I want to revert back to original as I don't particularly like the new colour.

My theory is to create a small JS file, that I can define Opera (my browser) to load when loading the site, which will change the colour of links back to the original colour. I have the colour code HTML I want to change it to.

I've only ever done a small amount of JS coding but from the research I've done it should go something like this,

document.style.alinkColor = "COLOR"

I got to that via discovering that

document.style.backgroundColor = "COLOR"

will change the background colour attribute, however it doesn't seem to work. I think my problem lies somewhere in the attribute name, I know the usually with JS CSS Attributes you would make the attribute starting with a lower case letter and the sub-attribute (e.g. the color bit) starting with an upper case.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved