我估计没人碰到过这个问题

wushichao1987 2009-07-22 08:22:38
<a href = "test.htm" onmouseover = "status = 'you will see this in the status' ; return true ;" >hello </a>
鼠标移动到链接区域时状态栏显示“you will see this in the status”这个字符串,我现在碰到的问题是:
将js代码提到一个函数中,如下所示:
function showStatus() {
status = "you will see this in the status" ;
return true;
}

链接改成这样:
<a href = "test.htm" onmouseover = "showStatus() ;" >hello </a>
此时状态栏不显示字符串,显示链接,也就是说函数没有返回true
而且在showStatus();调用后加上return true;又好使了。

敬请高手解答
...全文
131 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
浴火_凤凰 2009-07-23
  • 打赏
  • 举报
回复
此时状态栏不显示字符串,显示链接,因为那是浏览器的默认行为。
helanye 2009-07-22
  • 打赏
  • 举报
回复
这样些才对哦<a href = "test.htm" onmouseover = "return showStatus() ;" >hello </a>
startend 2009-07-22
  • 打赏
  • 举报
回复
鼠标移到链接时更新了状态栏内容,但是整个事件还没有结束,如果使用return则视为结束
virus7581 2009-07-22
  • 打赏
  • 举报
回复
<a href = "test.htm" onmouseover = "return showStatus() ;" >hello </a>

87,922

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧