我已经尝试了几个小时在这个网站上寻找,但没有解决我的问题 w/onmouseout。 我的 onmouseover 效果很好 w/c 我也是从这个网站得到的想法并使它起作用。
onmouseover="this.href = 'urlHere';"
我的 onmousever 没问题,但真正的问题是我的 onmouseout。
echo '<td><a onmouseover="this.href=\'main_db.php?page='.$iii_LV.'\'" onmouseout=""> '.$rows_LV['product_id'].'</a></td>';
为了让您了解我正在尝试做什么,这些是我编写的整个代码的一部分:
while($rows_LV = mysql_fetch_array($result_LV))
{
++$i_LV;
if ($i_LV%2 == 0)
{$colorb="#99CFFF";}
else
{$colorb="#FFFFFF";};
$iii_LV=$i_LV+$ii_LV;
echo '<tr bgcolor='.$colorb.' onmouseover=" mOver(this)" onmouseout=" mOut(this)" >';
echo '<td><a onmouseover="this.href=\'main_db.php?page='.$iii_LV.'\'" onmouseout=""> '.$rows_LV['product_id'].'</a></td>';
echo "<td> ".$rows_LV['name']."</a></td>";
echo "<td> ".$rows_LV['category']."</a></td>";
echo "<td> ".$rows_LV['cost']."</a></td>";
echo "<td> ".$rows_LV['retail']."</a></td>";
echo "</tr>";
};
任何帮助都会很棒,在此先感谢....
最佳答案
你实际上并没有在 onmouseout 上做任何事情..你是想做:
this.href = ''
请注意,单击空的 href
可能实际上返回页面,因此您必须使用 .removeAttribute
。
既然你有jquery , 最好单独绑定(bind)事件,你也可以获得更大的灵 active :
$('a').hover(
function () {
$(this).attr('href', 'urlHere');
},
function () {
$(this).removeAttr('href');
}
);
关于php - 如何删除 onmouseout 上的 href?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14167878/