本文介绍了状态栏显示锚点href,而不是我在onmouseover中设置的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个菜单树,由

多级列表中的列表项内的锚组成,其中包含以下HTML:


< ul id =''xx''>

< li>< a href =''conf.cgi''class =''menu''target =''main''

title =''配置东西''onclick =''记住(" conf.cgi")''

onmouseover =''handleOver(" Conf stuff)'''> ;设置< / a>< / li>

< / ul>


使用javascript


函数记住(cgi){

var exp = new Date();

exp.setTime(exp.getTime()+ 30 * 24 * 60 * 60 * 1000);

setCookie(''lastPage'',cgi,exp);

}

函数handleOver (文字){

window.status = text;

}


但当我将鼠标悬停在此状态栏上时,状态栏会显示完整路径

cgi:



我已将alert()放入handleOver()中我知道它被调用了

我的JavaScript控制台很干净。我做错了什么?


虽然我想要一个通用的解决方案,但我正在进行我的开发并在Mozilla 1.7.3上进行初始的

测试。


任何指针都赞赏。谢谢。


克里斯

I have a menu tree made up of anchors inside list items in a
multi-level list that includes HTML like:

<ul id=''xx''>
<li><a href=''conf.cgi'' class=''menu'' target=''main''
title=''Configure stuff'' onclick=''remember("conf.cgi")''
onmouseover=''handleOver("Configure stuff")''>Settings</a></li>
</ul>

with the javascript:

function remember(cgi) {
var exp = new Date();
exp.setTime(exp.getTime() + 30 * 24 * 60 * 60 * 1000);
setCookie(''lastPage'',cgi,exp);
}
function handleOver(text) {
window.status=text;
}

but when I mouse over this, the status bar shows the full path to the
cgi:

http://hostname/cgi-bin/conf.cgi

I''ve put an alert() into handleOver() so I know it''s getting invoked
and my JavaScript console is clean. What am I doing wrong?

While I want a general solution, I''m doing my development and initial
testing on Mozilla 1.7.3.

Any pointers appreciated. Thanks.

Chris

推荐答案





< script type =" text / javascript">

function setStatus(){

status =''Hello world' '

}

< / script>


< a href =''conf.cgi''onmouseout =' 'status =""''

onmouseover =''setTimeout(" setStatus()",10)''>

设置&l t; / a>

-

Evertjan。

荷兰。

(用点替换所有十字架在我的电子邮件地址中)



<script type="text/javascript">
function setStatus(){
status=''Hello world''
}
</script>

<a href=''conf.cgi'' onmouseout=''status=""''
onmouseover=''setTimeout("setStatus()",10)''>
Settings</a>
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)




comp.lang.javascript常见问题解答(就在你的面前):
< http://www.jibbering.com/faq/#FAQ4_35> ;



comp.lang.javascript FAQ (right in front of you):
<http://www.jibbering.com/faq/#FAQ4_35>




我已经尝试了几种变体而且都没有用。我能够完成的最好的是当鼠标进入锚点时状态

bar显示href,当鼠标离开锚点时,消息I 供应(当然,直到鼠标进入另一个锚点)。



I''ve tried several variations on that and none work. The best I''ve
been able to accomplish is when the mouse enters the anchor the status
bar shows the href and when the mouse leaves the anchor the message I
supply is displayed (until the mouse enters another anchor, of course).


这篇关于状态栏显示锚点href,而不是我在onmouseover中设置的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 23:22