473,473 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

event handlers in IE5

Sorry for the re-post but the original message subject no longer
applies. If I try this in IE5, it doesn't work:

<script type="text/javascript">
window.onload = foo;
</script>
<body>

whereas this does work:

<body onload="javascript:foo();">

This is not the way I want to handle events. I checked MSDN and it seems
to indicate that the first way should work. Is there something I can do
to get the first way (event handlers?) to work in IE5?

Andrew Poulos
Jul 23 '05 #1
4 1121
Andrew Poulos wrote:
Sorry for the re-post but the original message subject no longer
applies. If I try this in IE5, it doesn't work:

<script type="text/javascript">
window.onload = foo;
</script>
<body>
Why not? Do you have a foo function defined? What happens?
Works for me (but only, if there is no onload attribute set for the body
element).

whereas this does work:

<body onload="javascript:foo();">


The onload attribute is allready defined to contain script. You don't
need to use the javascript pseudoprotocoll here.

<body onload="foo();">

Daniel
Jul 23 '05 #2
Daniel Kirsch wrote:
Andrew Poulos wrote:
Sorry for the re-post but the original message subject no longer
applies. If I try this in IE5, it doesn't work:

<script type="text/javascript">
window.onload = foo;
</script>
<body>


Why not? Do you have a foo function defined? What happens?
Works for me (but only, if there is no onload attribute set for the body
element).


I've test a few other things and I may having looking in the wrong place
for the bug(s). My actual code looks like this:

<script type="text/javascript">
top.SetCurrent(self.location);
window.onload = foo;
</script>

I have a frame calling some functions loaded at the top. If I comment
out the first line the onload line works. This code, though, works (or
appears to) in MZ and IE6. Is IE5 expecting a 'return true;' from the
first function call?
whereas this does work:

<body onload="javascript:foo();">


The onload attribute is allready defined to contain script. You don't
need to use the javascript pseudoprotocoll here.

<body onload="foo();">


Thanks.

Andrew Poulos
Jul 23 '05 #3
Andrew Poulos wrote:
I've test a few other things and I may having looking in the wrong place
for the bug(s). My actual code looks like this:

<script type="text/javascript">
top.SetCurrent(self.location);
Do you really want to pass the location object or just the current url
as a string? I guess you search for:

top.SetCurrent(self.location.href);

I have a frame calling some functions loaded at the top. If I comment
out the first line the onload line works. This code, though, works (or
appears to) in MZ and IE6. Is IE5 expecting a 'return true;' from the
first function call?


No.

Daniel
Jul 23 '05 #4
Daniel Kirsch wrote:
Andrew Poulos wrote:
I've test a few other things and I may having looking in the wrong
place for the bug(s). My actual code looks like this:

<script type="text/javascript">
top.SetCurrent(self.location);


Do you really want to pass the location object or just the current url
as a string? I guess you search for:

top.SetCurrent(self.location.href);


Thanks, I'll look into using href instead,
I have a frame calling some functions loaded at the top. If I comment
out the first line the onload line works. This code, though, works (or
appears to) in MZ and IE6. Is IE5 expecting a 'return true;' from the
first function call?


No.


I can't really post all the code as there are 100s of lines but how can
I track down why it's not working just in IE5?

Andrew Poulos
Jul 23 '05 #5

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

Similar topics

10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
8
by: Dennis C. Drumm | last post by:
I have a class derived from a SortedList called SystemList that contains a list of objects indexed with a string value. The definition of the objects contained in the SortedList have a boolean...
18
by: bhavin | last post by:
Hi, Can someone point me to some good best practices kind of documentation on use of events compared to method overriding. Ex. In Windows Forms when should i have an event handler for Paint, and...
13
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the...
5
by: Amit | last post by:
Hello! Is it possible to find how many event handlers an event has at runtime? How about finding whether or not an event has event handlers? In C# you can compare the event with null to check if...
6
by: Kevin Attard | last post by:
I am using a GridView inside a UserControl which has a template column for deleting the rows. Before databinding the gridview i am attaching the RowCommand and RowDataBound event. I am using the...
16
by: Hamed | last post by:
Hello I am developing a utility to be reused in other programs. It I have an object of type Control (a TextBox, ComboBox, etc.) that other programmers use it in applications. they may set some...
14
by: Hamed | last post by:
Hello It seems that I should implement ICloneable to implement my own clone object. the critical point for me is to make a control object based on another control object that all of its event...
6
by: Jake K | last post by:
Where is the best place to define event handlers? I need to define event handlers for a COM object referenced in my project and am doing so in the fowm load. Is this the best place?
6
by: Tony Johansson | last post by:
Hello! I know it's possible to have several event handler for a single event but I can't see any point using several event handler for this. I'm probably wrong so can anybody tell me what...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.