473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Text color changes on rollover

I am working on a project for grad school that has me creating a webpage that needs to have a small javascript element that I'm having a lot of trouble with.

I need to make a link in Javascript that lets the user hover over the link, and when the mouse is over it, the color changes from blue (the regular) to white, but when the text is rolled over, it needs to have a dark green highlight.

So I need to go from a regular blue hyperlink with no highlight to a white texted green highlighted hyperlink, using Javascript.

Hopefully someone out there can help, there is nothing in my textbook about it. I've been using these two resources from the internet, but cannot get it to work.

http://www.javascriptkit.com/script/script2/highlight.shtml

http://www.rgagnon.com/jsdetails/js-0055.html

Each do something that I need to do, but neiter do both at the same time and I'm trying to put them together but they do not work.
Nov 28 '11 #1
8 1776
Rabbit
12,516 Expert Mod 8TB
What do you have so far?
Nov 28 '11 #2
omerbutt
638 512MB
hi blaze,
I need to make a link in Javascript that lets the user hover over the link, and when the mouse is over it, the color changes from blue (the regular) to white,
your start of the statement confuses with the ending part
but when the text is rolled over, it needs to have a dark green highlight.
what do you want that when the text is rolled over the color changes from blue to white or dark green and where is your code that you have written please paste it here
regards
,
Omer Aslam
Nov 28 '11 #3
What I need to have is

FIRST (with no rollover)
Blue text (like a regular hyperlink
SECOND (when the mouse is over)
White Text with a green highlight

Sorry, I was having trouble formulating it into a paragraph. Haha, hopefully this will help.
Nov 28 '11 #4
omerbutt
638 512MB
text with a green HIGHLIGHT , where do you got such an assignment , :d may be some thing else you want to say but not finding the right words , making text color change on hover does not require any javascript , you can have this working trough a css hover class butt adding hightlight / shadow are different and never cross browser , but you need to look to jquery for that , i seriously never heard of the term highlighting the text
Nov 28 '11 #5
I know, I am adept in CSS, and would LOVE if they would let me use CSS. This professor is crazy. He wants a green highlight on rollover, and white text to go with that green highlight. It's just odd, and I've been looking all over the internet and I'm only finding bits and pieces, and I cannot figure out how to put them together.
Nov 28 '11 #6
omerbutt
638 512MB
i cant figure out the HIGHLIGHT blazewalker :D , i just cant get the concept that how the text is going to be hightlighted , changing color makes sense but what kind of effect is highlight , i cant get it
regards,
Omer Aslam
Nov 28 '11 #7
Rabbit
12,516 Expert Mod 8TB
By highlight, he means change the background color of the text.
Nov 28 '11 #8
omerbutt
638 512MB
By highlight, he means change the background color of the text.
if this is what you mean blazewalker try this
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. </head>
  7. <style type="text/css">
  8.     a{
  9.         display:block;
  10.     }
  11. </style>
  12. <script type="text/javascript">
  13. function changeColor(eleObj,status){
  14.     if(status){
  15.         eleObj.style.backgroundColor='green';
  16.         eleObj.style.color='white';
  17.     }else{
  18.         eleObj.style.backgroundColor='white';
  19.         eleObj.style.color='blue';
  20.     }
  21. }
  22. </script>
  23. <body>
  24. <div>
  25.     <a href="#." onmouseover="changeColor(this,1);" onmouseout="changeColor(this,0)">This is a link</a>
  26. </div>
  27. </body>
  28. </html>
  29.  
regards,
Omer Aslam
Nov 28 '11 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Matt Adams | last post by:
As well known I could specify the text color in the body tag like: <BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE> What I want to achieve now is that always (!) the text of the last visited...
3
by: Alpha | last post by:
Hello. I am not a C++ programmer...I have studied a bit of Java, but that's it. However, I am playing an online game written in C++. I was wondering how one could change the color of text (that...
5
by: AFN | last post by:
I'm trying to set a submit button to change text and color when clicked. Like saying "please wait" instead of "submit" and then changing the background color and text color. All works, except for...
31
by: Chris Stanley | last post by:
I am using dreamweaver to make an ASP page. I have a table of data from a MSSQL database that is currently showing on the ASP page. I want the ability to change the color based on a priority...
2
by: ASP Yaboh | last post by:
I have a Repeater control bound to a DataSet that creates a table with 6 columns. The text displayed in one of the columns may need to be set to grey instead of black. The DataSet is held and...
2
by: Amy | last post by:
<style> div.helpBtn{ font:bold 73% verdana; color:#995F8D; text-align:left; width:79px; height:24px; margin:0px; padding: 5px 0px 0px 27px; background:...
4
by: tsahiasher | last post by:
hi, i'm trying to use the RichTextBoxSelectionColor property, but in any combination of command order i try, the text color is not changed. the only time it worked was when i set SelectionStart =...
4
by: cpbsmw | last post by:
I need to write a code that causes the background color and text color of a control when its value changes. for example if the word in the control is Afghanistan i need the background color to be...
10
by: sbaker8688 | last post by:
My God, how on earth do you use javacript to change the text color of an input element, and have it work with IE??? I've tried numerous solutions. All of them work on browsers such as Mozilla. ...
6
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I want to specify a custom color for disabled text that is used by a class that inherits from ToolStripProfessionalRenderer. The code would look something like this: Public Class MyRenderer...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.