开发者

onmouseover and onmouseout

开发者 https://www.devze.com 2023-02-19 03:59 出处:网络
i have a problem with onmouseover and onnmouseout, it doesn\'t work. $tr_mouseover = \"#d3d3d3\"; $tr_mouseout = \"#bababa\";

i have a problem with onmouseover and onnmouseout, it doesn't work.

$tr_mouseover = "#d3d3d3";
$tr_mouseout = "#bababa";

$table_height = "<tr bgcolor=".$tr_bg." height=\"40\" onmouseover=\"this.bgCo开发者_如何学运维lor=".$tr_mouseover."\" onmouseout=\"this.bgColor=".$tr_mouseout."\"> "; 


Have you tried quoting your color values? Like this:

$table_height = "<tr bgcolor=".$tr_bg." height=\"40\" onmouseover=\"this.bgColor='".$tr_mouseover."'\" onmouseout=\"this.bgColor='".$tr_mouseout."'\"> ";

Note the ' characters that have been added around the color values. The markup that gets generated should look roughly like this:

<tr bgcolor="#FF0000" height="40" onmouseover="this.bgColor='#d3d3d3';" onmouseout="this.bgColor='#bababa';">

...which behaves correctly for me in Chrome, Firefox, and IE.


Try this.style.backgroundColor (to my knowledge there's no bgColor)

0

精彩评论

暂无评论...
验证码 换一张
取 消