473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

javascript: void(0) problem

I've a 'TEST' link on page, which has href='javascript: void(0)', and
a big iframe page.
When I load the page, window.onload event is triggered after the big
iframe page loaded,
If I click the 'TEST' link before the window.onload execute, the
window.onload will never execute in IE 6.0.
<html>
<body>
<a href='javascript: void(0)'>TEST</a>
<div id='tt'></div>
<iframe src='http://www.yahoo.com'></iframe>
<script>
window.onload = function(){
document.getElementById('tt').innerHTML = '1';
}
</script>
</body>
</html>

Apr 17 '07 #1
3 3469
buhailiang said the following on 4/16/2007 10:22 PM:
I've a 'TEST' link on page, which has href='javascript: void(0)', and
a big iframe page.
When I load the page, window.onload event is triggered after the big
iframe page loaded,
If I click the 'TEST' link before the window.onload execute, the
window.onload will never execute in IE 6.0.
Yet another reason not to use a javascript: URL
<URL:http://jibbering.com/faq/index.html#FAQ4_24>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 17 '07 #2
Randy Webb wrote on 17 apr 2007 in comp.lang.javascript:
buhailiang said the following on 4/16/2007 10:22 PM:
>I've a 'TEST' link on page, which has href='javascript: void(0)', and
a big iframe page.
When I load the page, window.onload event is triggered after the big
iframe page loaded,
If I click the 'TEST' link before the window.onload execute, the
window.onload will never execute in IE 6.0.

Yet another reason not to use a javascript: URL
<URL:http://jibbering.com/faq/index.html#FAQ4_24>
Right you are, Randy, but what is the problem of the OP?

If he/she does not like the behavour, why put in that link?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 17 '07 #3
Evertjan. said the following on 4/17/2007 3:58 AM:
Randy Webb wrote on 17 apr 2007 in comp.lang.javascript:
>buhailiang said the following on 4/16/2007 10:22 PM:
>>I've a 'TEST' link on page, which has href='javascript: void(0)', and
a big iframe page.
When I load the page, window.onload event is triggered after the big
iframe page loaded,
If I click the 'TEST' link before the window.onload execute, the
window.onload will never execute in IE 6.0.
Yet another reason not to use a javascript: URL
<URL:http://jibbering.com/faq/index.html#FAQ4_24>

Right you are, Randy, but what is the problem of the OP?
The problem of the OP is that they are clicking on a link before the
page has finished loading so the onload event never fires. It will do
that with *any* link if there is nothing in the link to tell the browser
not to navigate. The only reason the OP is seeing the behavior and
doesn't see it with a "normal" link is that a normal link causes the
browser to navigate away so you don't realize the onload event never fired.
If he/she does not like the behavour, why put in that link?
Precisely.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 17 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael | last post by:
Hallo I have the following problem: Within a web application I have to access the Java methods from JavaScripts. I'm using Sun's Java virtual machine version 1.3.1. Webbrowser is Microsoft...
1
by: Martin O'Rourke | last post by:
All, I am trying to use a URL to call some javascript to do something, which is working fine in IE6 but using the same code in Netscape 4.79 I cannot get it to work at all. I get no errors,...
3
by: IntraRELY | last post by:
I need to attach the following 2 little scripts to an ASP.NET Button. I am having an issue with running both of the Attributes.Add. I can only get on to work at once. I have also tried to put them...
13
by: Jitendra | last post by:
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>...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
8
by: Frank | last post by:
Hi, I am working with VS.NET 2005 Ultimately, I wish to call a JavaScript function from a .js file
15
by: Phlip | last post by:
Javascripters: I have an outer page and an inner iframe. The outer page calculates some javascript, and wants the inner frame to run it. The inner frame should hit a page on the same (private)...
3
by: jesper_lofgren | last post by:
Hello, I have a problem, i have a event in asp.net codebehind file that updating a datasource. If that update went well i want to refresh my treeview thats on another page. The script works...
3
by: SM | last post by:
Hello, Im trying to access elements in my XML file using the JavaScript DOM but i'm not sure how. I use AJAX to access the XML and then use the responseXML property to access the XML file data. I...
1
by: kret | last post by:
Hi, this is my first post so first of all I would like to say hello :) Now getting to my problem. In my job I have to create an ActiveX control in .NET 1.1 that can be lunched from IE....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.