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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlighting Text Onmouseover 1

Status
Not open for further replies.

bretttt

Programmer
Jul 23, 2002
74
US
is there a way to highlight text onmouseover
 
<script type=&quot;text/javascript&quot;>
function highlight(el) {
el.style.backgroundColor =
el.style.backgroundColor == &quot;yellow&quot; ?
&quot;&quot; : &quot;yellow&quot;;
}
</script>

<span onmouseover=&quot;highlight(this);&quot; onmouseout=&quot;highlight(this);&quot;>mouse over me</span>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
i have this
<script type=&quot;text/javascript&quot;>
function highlight(el) {
el.style.backgroundColor =
el.style.backgroundColor == &quot;yellow&quot; ?
&quot;&quot; : &quot;yellow&quot;;
</script>

<span onmouseover=&quot;highlight(this);&quot; onmouseout=&quot;highlight(this);&quot;>Mouse me </span>

I get line 8 char 1 object expected... Please Help.
 
Jeff's code works fine for me... Your missing a closing &quot;}&quot; for the function...

<script type=&quot;text/javascript&quot;>
function highlight(el) {
el.style.backgroundColor =
el.style.backgroundColor == &quot;yellow&quot; ?
&quot;&quot; : &quot;yellow&quot;;
}
</script>



Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top