尝试从onclick运行一个函数而不激活链接 [英] Trying to run a function from onclick without activating the link
问题描述
我在网页上有以下链接
< p class =" menuitem">< a href ="#"
onclick =" loadFragment(''http://rivendellweb.net/fortress/home'',
''index'')" title =" The Fortress Home"> The Fortress Home< / a>< / p>
解决方案
Carlos Araya写道:
我在网页上有以下链接
< p class =" menuitem">< ; a href ="#"
onclick =" loadFragment(''http://rivendellweb.net/fortress/home'',
''索引'')" title =" The Fortress Home"> The Fortress Home< / a>< / p>
< p class =" menuitem"
onclick =" loadFragment('''http://rivendellweb.net/fortress / home'',
''index'')"
title =" The Fortress Home"> The Fortress Home< / p>
PS受访者也可以方便地在邮件正文中查看实际的问题/问题,而不仅仅是标题。
< blockquote> Carlos Araya在12/25/2006下午5:47发表以下内容:
我在网页上有以下链接
>
< p class =" menuitem">< a href ="#"
onclick =" loadFragment('''http://rivendellweb.net/堡垒/家庭'',
''index'')" title =" The Fortress Home"> The Fortress Home< / a>< / p>
< a href =" http:// rivendellweb .net / fortress / home"
title =" The Fortress Home"
onclick =" loadFragment(this.href,''index''); alert( ''ig nore VK'');返回false">
Fortress Home< / a>
取消导航的技巧是在事件处理程序中返回false。
-
Randy
机会有利于准备好的心灵
comp .lang.javascript常见问题 - http://jibbering.com/faq/index.html
Javascript最佳实践 - http:// www。 JavascriptToolbox.com/bestpractices/
Randy Webb写道:
.... alert(''忽略VK'') ...
< http://jsnet.sourceforge.net/tmp/irw.html>
I have the following link on a web page
<p class="menuitem"><a href="#"
onclick="loadFragment(''http://rivendellweb.net/fortress/home'',
''index'')" title="The Fortress Home">The Fortress Home</a></p>
Carlos Araya wrote:I have the following link on a web page
<p class="menuitem"><a href="#"
onclick="loadFragment(''http://rivendellweb.net/fortress/home'',
''index'')" title="The Fortress Home">The Fortress Home</a></p><p class="menuitem"
onclick="loadFragment(''http://rivendellweb.net/fortress/home'',
''index'')"
title="The Fortress Home">The Fortress Home</p>
P.S. It is convenient for respondents to see the actual
question/problem in the message body as well, not in the title only.
Carlos Araya said the following on 12/25/2006 5:47 PM:I have the following link on a web page
<p class="menuitem"><a href="#"
onclick="loadFragment(''http://rivendellweb.net/fortress/home'',
''index'')" title="The Fortress Home">The Fortress Home</a></p>
<a href="http://rivendellweb.net/fortress/home"
title="The Fortress Home"
onclick="loadFragment(this.href,''index'');alert(''ig nore VK'');return false">
The Fortress Home</a>
The trick to "cancel navigation" is to return false in the event handler.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Randy Webb wrote:
.... alert(''ignore VK'') ...
<http://jsnet.sourceforge.net/tmp/irw.html>
这篇关于尝试从onclick运行一个函数而不激活链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!