Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NewBie -HTML change text on mouse over.

Status
Not open for further replies.

Bretto

Technical User
Oct 17, 2001
59
AU
I have the following html code with vbscript and wish to change the background color and the text color of a cell in a table when the mouse moves over it, I can get the background color to change but not the text?


<html>
<script language=&quot;VBScript&quot; for=&quot;Td_Opt_1&quot; event=&quot;OnMouseOver&quot;>
Td_Opt_1.bgcolor=&quot;blue&quot;
document.all.opt_1_txt.style.color=&quot;white&quot;
</script>


<body bgcolor=&quot;8040c0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; topmargin=&quot;0&quot; leftmargin=&quot;0&quot;>
<center>
<br>
<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;1&quot; cellpadding=&quot;5&quot;>


<tr><td id=&quot;Td_Opt_1&quot; height=&quot;35&quot; bgcolor=&quot;c0ff60&quot; Align=&quot;Center&quot;><p id=&quot;opt_1_txt&quot;><b><font color=&quot;8040c0&quot;>Option 1</font></b></td></tr>




<tr><td height=&quot;35&quot; bgcolor=&quot;c0ff60&quot;><font color=&quot;8040c0&quot;><center><b>Option 2</b></center></font></td></tr>
<tr><td height=&quot;35&quot; bgcolor=&quot;c0ff60&quot;><font color=&quot;8040c0&quot;><center><b>Option 3</b></center></font></td></tr>
<tr><td height=&quot;35&quot; bgcolor=&quot;c0ff60&quot;><font color=&quot;8040c0&quot;><center><b>Option 4</b></center></font></td></tr>
<tr><td height=&quot;35&quot; bgcolor=&quot;c0ff60&quot;><font color=&quot;8040c0&quot;><center><b>Option 5</b></center></font></td></tr>
<tr><td height=&quot;35&quot; bgcolor=&quot;c0ff60&quot;><font color=&quot;8040c0&quot;><center><b>Option 6</b></center></font></td></tr>
</center>

</body>
<Html>


Please help?
 
This is normal, you overlaped the style of Paragraph opt_1_txt with font tag that redefines text color. Try this, it should work :
Code:
<html>
<script language=&quot;VBScript&quot; for=&quot;Td_Opt_1&quot; event=&quot;OnMouseOver&quot;>
Td_Opt_1.bgcolor=&quot;blue&quot;
document.all.opt_1_txt.style.color=&quot;white&quot;
</script>


    <body bgcolor=&quot;8040c0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; topmargin=&quot;0&quot; leftmargin=&quot;0&quot;>
    <center>
    <br>
    <table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;1&quot; cellpadding=&quot;5&quot;> 
    

<tr><td id=&quot;Td_Opt_1&quot; height=&quot;35&quot; bgcolor=&quot;c0ff60&quot; Align=&quot;Center&quot;><p><b><font
id=&quot;opt_1_txt&quot;
Code:
color=&quot;8040c0&quot;>Option 1</font></b></td></tr>
    



<tr><td height=&quot;35&quot; bgcolor=&quot;c0ff60&quot;><font color=&quot;8040c0&quot;><center><b>Option 2</b></center></font></td></tr>
    <tr><td height=&quot;35&quot; bgcolor=&quot;c0ff60&quot;><font color=&quot;8040c0&quot;><center><b>Option 3</b></center></font></td></tr>
    <tr><td height=&quot;35&quot; bgcolor=&quot;c0ff60&quot;><font color=&quot;8040c0&quot;><center><b>Option 4</b></center></font></td></tr>
    <tr><td height=&quot;35&quot; bgcolor=&quot;c0ff60&quot;><font color=&quot;8040c0&quot;><center><b>Option 5</b></center></font></td></tr>
    <tr><td height=&quot;35&quot; bgcolor=&quot;c0ff60&quot;><font color=&quot;8040c0&quot;><center><b>Option 6</b></center></font></td></tr>
    </center>    
    
</body>
</Html>

Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top