Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Javascript Disables Css Link?
rkosh
post May 8 2005, 12:49 AM
Post #1


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 8
Joined: 26-March 05
Member No.: 3,254



Here's the code I'm using for my javascript link I decided to add to a website I'm working on:

<li><a type="button" href="javascript: history.go(-1)">Go Back</a></li>

The problem is that the css doesn't affect the javascript link. It displays as a plain blue underlined link. The stylesheet correctly renders regular links to other pages in the site, so the problem doesn't lie in my CSS coding. Thanks for the help.
Go to the top of the page
 
+Quote Post
jet
post May 8 2005, 06:03 AM
Post #2


Advanced Member
Group Icon

Group: Members
Posts: 140
Joined: 24-April 05
From: Australia
Member No.: 4,289



Maybe you should add the style straight into the <A> code? Like <a type="button" href="javascript:history.go(-1)" style="color: ... ... ">. I don't quite understand the "button" bit.. If its meant to be a button, isn't it meant to be a button instead of underlined text? When I used the text link for "go back" on one of my sites some time back I believe the CSS had no problems with javascript.
Go to the top of the page
 
+Quote Post
overture
post May 8 2005, 09:15 AM
Post #3


Premium Member
Group Icon

Group: Members
Posts: 208
Joined: 6-September 04
From: England
Member No.: 315



normal hyperlinks reference:

CODE
a:link, a:visited, a:active {
color: #000000;
font-weight: none;
text-decoration: underline;
}

a:hover {
color: #880000;
text-decoration: none;
}


----------------------------

i just tested it and it works fine for me. try adding this in the css page:

CODE

li a:link, li a:visited, li a:active {
color: #000000;
font-weight: none;
text-decoration: underline;
}
li a:hover {
color: #880000;
text-decoration: none;
}


so if a link is within the <li></li> tags then it will be formatted to whatever you put into the code i have given above.

what browser are you using? it works for me fine in IE and FF.
Go to the top of the page
 
+Quote Post
pbolduc
post May 8 2005, 11:08 AM
Post #4


Member - Active Contributor
Group Icon

Group: Members
Posts: 92
Joined: 15-December 04
From: New Mexico
Member No.: 1,759



QUOTE(rkosh @ May 7 2005, 05:49 PM)
Here's the code I'm using for my javascript link I decided to add to a website I'm working on:

<li><a type="button" href="javascript: history.go(-1)">Go Back</a></li>

The problem is that the css doesn't affect the javascript link.  It displays as a plain blue underlined link.  The stylesheet correctly renders regular links to other pages in the site, so the problem doesn't lie in my CSS coding.  Thanks for the help.
*




You can also simply add a class property to your link:

CSS Code:
CODE

a.whateverclass:link {color: #000066; text-decoration: none}

a.whateverclass:visited {color: #000066; text-decoration: none}

a.whateverclass:hover {color: #006600; text-decoration: underline}

a.whateverclass:active {color: #FFFF00; text-decoration: none}



Link Code:
CODE

<li><a type="button" href="javascript: history.go(-1)" class="whateverclass">Go Back</a></li>



Hope This Helps,
pete cool.gif
Go to the top of the page
 
+Quote Post
rkosh
post May 8 2005, 08:41 PM
Post #5


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 8
Joined: 26-March 05
Member No.: 3,254



I'm such an idiot! I just realized I specified "type" instead of "class" on that link!!!. Thanks pbolduc!
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. JavaScript template(1)
  2. Javascript(20)
  3. What Is The Best Javascript Menu Builder?(7)
  4. Find Out Dead Links In Your Site Automatically(11)
  5. Random Images On Eacht Pageload And Refresh.(6)
  6. Hiding/showing Text On Click(2)
  7. Get Input From Html/txt File?(2)
  8. JavaScript(1)
  9. 1 Joomla Skin For Flash Animated Portals: Mbt_macro_blue(0)
  10. Where To Get Chat/Guestbook/Photo Album etc. Scripts?(4)
  11. Javascript Show / Hide Functions(3)
  12. Imagemap With Image As Other Link(0)
  13. Can I Make A Webpage With Javascript(9)
  14. Ie Png Transparency Javascript?(3)
  15. Xhtml, Javascript, Css And Frames.(0)
  1. Javascript Problem(3)


 



- Lo-Fi Version Time is now: 8th September 2008 - 09:43 AM