Forum Moderators: open

Message Too Old, No Replies

Javascript Mouseover not Working

         

snay

6:23 am on May 10, 2005 (gmt 0)

10+ Year Member



Hello,

I have been trying to fix this script since last couple of hours but no luck. I would appreciate if anyone here could help me out.

The original code is:

<table width='204' border='0' cellpadding='3' cellspacing='1' bgcolor='#D9E7CB'>
<tr>
<td onMouseOver="this.className='text_4_b'" onMouseOut="this.className='text_4_a'" bgcolor='#FFFFFF' class='text_4_a'>
<a class='link_related' href='SearchResults.html'>LINK 1</a>
</td>
</tr>
</table>

but i have to display it in Javascript for some reasons so i updated the code and now it looks like this:

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
document.write("<table width='204' border='0' cellpadding='3' cellspacing='1' bgcolor='#D9E7CB'>");
document.write("<tr>");
document.write("<td onMouseOver="this.className='text_4_b'" onMouseOut="this.className='text_4_a'" bgcolor='#FFFFFF' class='text_4_a'>");
document.write("<a class='link_related' href='SearchResults.html'>LINK 1</a>");
document.write("</td>");
document.write("</tr>");
document.write("</table>");
</script>

Whenever i test it in a browser it doesn't show anything and when i replace;

"this.className='text_4_b'" with 'this.className='text_4_b'' it starts working but the "td" rollover doesn't work.

---
CSS Code
--
.text_4_a {font-size: 11px; font-family: Verdana; color: #333333; padding: 3px 8px;}

.text_4_b {font-size: 11px; font-family: Verdana; color: #333333; background-color: #F9F9F9; padding: 3px 8px;}

Is there anyway i can fix it quickly?

Thanks

Is there anyway i can fix it quickly?

snay

7:09 am on May 10, 2005 (gmt 0)

10+ Year Member



Nevermind i got it fixed.

I'm using
this.className='text_4_b' instead of "this.className='text_4_b'" or 'this.className='text_4_b''.