【问题标题】:disable onmouseout function when onclick event is activated激活 onclick 事件时禁用 onmouseout 功能
【发布时间】:2010-06-23 00:32:32
【问题描述】:

我的代码使用 Dreamweaver 的 Image Swap 看起来像这样。

<a href = "#"> <img src="images/leistungen.png" alt="leistungen" name="leistungen"
 width="162" height="38" id="leistungen"
onclick="MM_swapImage('home','','images/home_orig.png','philosophie','', 'images/philosophie.png','kontakt','','images/kontakt.png','body_layout','','images/body_leistungen.png',0)"
onmouseover="MM_swapImage('leistungen','','images/leistungen_onclick.png',1)"
onmouseout="roll()" /></a>

那我就有这个功能了

function roll(){
var temp; temp.src = 'images/leistungen_onclick.png';
if(document.leistungen.src == temp.src){return false;}
else {document.leistungen.src = 'images/leistungen.png';}
}

我希望 roll() 函数检测图像是否被点击.. 所以我的解决方案是检查图像源是否为 leistungen_onclick.png 如果不是则执行 onmouseover 功能..

if(document.leistungen.src == temp.src){return false;}

从未执行过... 我的问题是..确定图像的图像来源的正确方法是什么?或者有没有一种简单的方法可以在执行 onclick 功能时禁用 onmouseover 功能?

非常感谢! 小 编辑:对不起,我不知道如何使它成为代码标签。现在我知道了。

【问题讨论】:

  • 请通过缩进 4 个空格重新格式化您的代码部分。我会自己做,但我还不能编辑其他人的帖子。

标签: javascript image dreamweaver swap


【解决方案1】:
<a href="#" img src="images/leistungen.png" alt="leistungen" name="leistungen"      
width="162" height="38" id="leistungen"    
onclick="MM_swapImage('home','','images/home_orig.png','philosophie','','images/philosophie.png','kontakt','','images/kontakt.png','body_layout','','images/body_leistungen.png',0)`;this.onmouseout=''" 
onmouseover="MM_swapImage('leistungen','','images/leistungen_onclick.png',1)"         
onmouseout="document.leistungen.src = 'images/leistungen.png';">Text</a>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-05
    • 2014-10-20
    • 1970-01-01
    • 1970-01-01
    • 2011-02-03
    • 1970-01-01
    • 2015-08-14
    相关资源
    最近更新 更多