HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 31st, 2003, 07:33 AM
Jessica's Avatar
Jessica Jessica is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 37 Jessica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Hover plaintext change

How can I get plain text to change color when I hover the mouse over it using css?
I can get linked text to change color ok but not plain text.

any ideas

Reply With Quote
  #2  
Old October 31st, 2003, 08:46 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,770 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 6 h 58 m 22 sec
Reputation Power: 469
Code:
<HTML>
<HEAD>
<STYLE>
A:hover{COLOR:red; TEXT-DECORATION: none}
A{COLOR: #00008b}
</STYLE>
<SCRIPT language=javascript>
function highlight()
{
 var oObj = event.srcElement
 oObj.style.color = "#FF00FF" ;
 //oObj.style.textDecoration = "underline" ;
}

function lolight()
{
 var oObj = event.srcElement
 oObj.style.color = "#008000" ;
 oObj.style.textDecoration = "none" ;
}
</SCRIPT>
</HEAD>
<BODY>
<DIV id=o style="color:#008000;" onmouseover="highlight()"
onmouseout="lolight()">Javascript style modification</DIV>
</BODY>
</HTML>


Reply With Quote
  #3  
Old October 31st, 2003, 09:20 AM
Jessica's Avatar
Jessica Jessica is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 37 Jessica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
I was rather hoping i could do this without any java just using the css.
This is what I use now but the class="submenulink" is on a href and it works fine
Code:
.submenulink
{
	color: black;
	text-decoration: none
}
:hover.submenulink
{
	color: red
} 

But I also have just plain text that I want to change the color on but it is not linked to a href and as the class="menu"
Code:
.menu
{
	color: black;
	text-decoration: none
}
:hover.menu
{
	color: red
} 

class="menu" wont work as it's on a plain bit of text, and I was rather hoping to achieve this in the ccs without any java if possible

Reply With Quote
  #4  
Old October 31st, 2003, 09:26 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,770 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 6 h 58 m 22 sec
Reputation Power: 469
That isn't possible. It has to use JavaScript to detect the client-side movement and placement of the mouse.

You can set a css value to the text being displayed and it will not affect any of the font attributes, it will only change the color of the text. But you still need to have the javascript to allow for detection of the mouse events.
Code:
<DIV onmouseover="highlight()"
onmouseout="lolight()"><span class="txtSmallRed">Javascript style modification</span></DIV>

Last edited by Memnoch : October 31st, 2003 at 09:31 AM.

Reply With Quote
  #5  
Old October 31st, 2003, 09:31 AM
Jessica's Avatar
Jessica Jessica is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 37 Jessica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Ah well I thought there would of been a way of doing this like i did with the class="submenulink" without any java at all

Sounds like I can't do it then with plain text what a pain, never mind it looks like I'm gonna have to use the java script you posted thsnks for that, orrrrr I could use some kind of dumby href in the plain text?

Reply With Quote
  #6  
Old November 13th, 2003, 01:54 AM
Jessica's Avatar
Jessica Jessica is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 37 Jessica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Only thing wrong with that java code Memnoch gave me is that it don't work in netscape 7 or Mozilla, as anyone got a similar code that is cross browser compatable?

Reply With Quote
  #7  
Old January 10th, 2004, 08:47 PM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
first of all, make sure you understand that there is a difference between Java and JavaScript. There is no relationship between the two.

You'll have to use Javascript I think. There is a hover option for the a tag but not other text from waht I understand. In javascript try element.style.color: instead of just color:. I think this should work in Netscape 7 and Mozilla

Reply With Quote
  #8  
Old January 14th, 2004, 04:50 AM
snowflake snowflake is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 1 snowflake User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
you don't need javascript.

You were nearly right:-
<style type="text/css">
<!--
.submenulink {
color: #0000CC;
}
a.submenulink:hover {
color: #FF0000;
}
-->
</style>
</head>

<body>
<a href="#" class="submenulink">Blah</a>I </body>

You don't need javascript :-)
Err just looked at the date this probably isn't helpful to you now.

Last edited by snowflake : January 14th, 2004 at 04:55 AM.

Reply With Quote
  #9  
Old January 14th, 2004, 09:49 AM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
snowflake, that's color change for a hyperlink. The goal is to apply the same rollover effect to "plain text" which would require javascript. The "a" tag shown below immediately applies this hover option for a hyperlink.
a.submenulink:hover {
color: #FF0000;
}

I think the magical, nonexistent CSS capability would look something like:
.submenulink:text {
color: #0000CC;
}
.submenulink:hover {
color: #FF0000;
}
... or some variation of that. It doens't exist so I guess I can use whatever syntax I want

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Hover plaintext change


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT