IE 6,javascript:void(0)停止加载网页 [英] IE 6, javascript:void(0) stops the webpage loading

查看:76
本文介绍了IE 6,javascript:void(0)停止加载网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我遇到''javascript 的问题:void(0)''


Software Environ : -

IE:6.0.2600.0000

操作系统:带Service Pack 4的Windows 2000专业版


问题: -

我有一个带有多个链接(< A>标签)的网页,现在我已经添加了

onClick并使用''javascript 阻止了HREF:void( 0)''如下: -


< a href =" javascript :void(0)"

onClick =" some_function(''pagename'')">文字< / a>


这里''some_function''在新的'打开''pagename''定制

窗口。


此页面还包含一些重量为50kb的图像。现在,如果我点击

< a>在图像完全加载之前的链接,发生以下情况(在我的

pc上它运行良好,但是当我在线测试时它会发生): -


1。新页面将根据需要在窗口中打开

2.但页面加载已中止并且未加载图像。


更多: -

这不是在FF 1.0.7中发生的。

需要帮助!

Hi!
I m facing a problem with ''javascript:void(0)''

Software Environ:-
IE: 6.0.2600.0000
OS: Windows 2000 Professional with Service Pack 4

Problem:-
I have a webpage with several links (<A> tags), now i have added
onClick and blocked HREF using ''javascript:void(0)'' as below:-

<a href="javascript:void(0)"
onClick="some_function(''pagename'')">Text</a>

Here ''some_function'' is opening the ''pagename'' in a new customised
window.

This page also contains a few images weighing 50kb. Now if I click the
<a> links before the images are loaded fully, following happens (on my
pc it works well but it happens when i test it online):-

1. The new page opens in a window as required
2. But the page loading is ABORTED and the images are not loaded.

More:-
This is not happening in FF 1.0.7

Need Help!

推荐答案

Jitendra写道:
Jitendra wrote:
嗨!
我遇到了''javascript 的问题:void(0)''
操作系统:带Service Pack 4的Windows 2000专业版

问题: -
我有一个包含多个链接的网页(< A>标签),现在我添加了
onClick并使用''javascript :void(0)'阻止了HREF,如下所示: -

< a href =" javascript :void(0)"
onClick =" some_function(''pagename'')"> Text< / a>


这是IE的一个已知功能,为什么主动不鼓励使用javascript

伪协议来表示HREF属性的值。


< URL:
http://groups.google.com/group/comp=\"07ad60e4d8fe1f
Hi!
I m facing a problem with ''javascript:void(0)''

Software Environ:-
IE: 6.0.2600.0000
OS: Windows 2000 Professional with Service Pack 4

Problem:-
I have a webpage with several links (<A> tags), now i have added
onClick and blocked HREF using ''javascript:void(0)'' as below:-

<a href="javascript:void(0)"
onClick="some_function(''pagename'')">Text</a>
This is a known feature of IE and why the use of the javascript
pseudo-protocol for the value of HREF attributes is actively discouraged.

<URL:
http://groups.google.com/group/comp....07ad60e4d8fe1f




使用类似的东西:


< a href =" serverFunction.html"

onClick =" some_function(''pagename''); return false;"> Text< / a>

其中href属性允许在

服务器上执行该功能并且返回false会在JavaScript

启用后停止跟踪。

[...]

-

Rob



Use something like:

<a href="serverFunction.html"
onClick="some_function(''pagename'');return false;">Text</a>
Where the href attribute allows the function to be performed on the
server and the return false stops it being followed where JavaScript
is enabled.
[...]
--
Rob




RobG napisal(a):

RobG napisal(a):
Jitendra wro te:
Jitendra wrote:
< a href =" javascript :void(0)"
onClick =" some_function(''pagename'')" >文字< / a>
<a href="javascript:void(0)"
onClick="some_function(''pagename'')">Text</a>


使用类似:

< a href =" serverFunction.html"
onClick =" some_function('' pagename''); return false;"> Text< / a>

href属性允许在
服务器上执行该函数,返回false则停止跟踪在哪里启用了JavaScript


Use something like:

<a href="serverFunction.html"
onClick="some_function(''pagename'');return false;">Text</a>

Where the href attribute allows the function to be performed on the
server and the return false stops it being followed where JavaScript
is enabled.




如果您没有基于服务器的替代方案,请使用

之类的东西:

< a href ="#" onClick =" some_function(''pagename''); return false;"> Text< / a>

如果用户关闭了javascript,该链接仍然没有

效果,但附加#除外到URL。当然如果你想为js错误获得一些g />
CGI后备,那么保留''备份链接'',但是如果它是

是一个页面说对不起,你需要Javascript,如果它更好的话,那就更好了。




And if you don''t have some server-based alternative, use something
like:
<a href="#" onClick="some_function(''pagename'');return false;">Text</a>
and if the user has javascript turned off, the link will still have no
effect except of appending "#" to the URL. Of course if you want some
CGI fallback for js fault, then keep the ''backup link'', but if it''s to
be a page that says "Sorry, you need Javascript", better if it does
nothing instead.


bw **** @ gmail.com 写道:
bw****@gmail.com wrote:
如果你没有一些基于服务器的替代方案,使用
之类的东西:
< a href ="#" onClick =" some_function(''pagename''); return false;"> Text< / a>
如果用户关闭了javascript,该链接仍然没有
效果,除非附加#到URL。


....并让用户想知道为什么链接不起作用(可能在他们之后

等待几分钟的时间) ;新页面加载。


....并且如果用户已滚动,则将用户推回到页面顶部

降至转到链接。

当然如果你想为js故障获得一些CGI后备,那么保留''备份链接'',但如果它是'
是一个页面,上面写着对不起,你需要Javascript,如果没有,那就更好了。
And if you don''t have some server-based alternative, use something
like:
<a href="#" onClick="some_function(''pagename'');return false;">Text</a>
and if the user has javascript turned off, the link will still have no
effect except of appending "#" to the URL.
.... and making the user wonder why the link didn''t work (probably after they
wait for a couple of minutes for the "new page" to load).

.... and shoving the user back up to the top of the page if they had scrolled
down to get to the link.
Of course if you want some
CGI fallback for js fault, then keep the ''backup link'', but if it''s to
be a page that says "Sorry, you need Javascript", better if it does
nothing instead.




我不同意。当用户期望某些事情发生时,系统不应该为他们默默地失败。服务器端替代方案是最好的,但是错误

消息根本不打算。


另一种选择是首先用JavaScript生成链接 -

测试后可以获得所有需要的功能。


-

David Dorward< http:// blog。 dorward.me.uk/> < http://dorward.me.uk/>

首页是〜/ .bashrc的位置



I disagree. When the user expects something to happen, the system shouldn''t
silently fail on them. A server side alternative is best, but an error
message beats nothing at all.

Another option is to generate the link with JavaScript in the first place -
after testing that all the needed features are available.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


这篇关于IE 6,javascript:void(0)停止加载网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆