Hello,
I would like to create an onload event within my object.
The following works fine :
function TEST()
{
this.image= new Image();
}
TEST.prototype. Initialize = function()
{
var _this = this;
this.image.onlo ad = function(){_thi s.Alerting("Ima ge Loaded");};
this.image.src = "winxp.gif" ;
}
TEST.prototype. Alerting = function(i_stri ng){alert(i_str ing);}
var mTest = new TEST();
mTest.Initializ e();
mTest.image.att achEvent("onloa d",function(){a lert("Load event access from
page");},false) ;
But i would rather be able to use :
mTest.attachEve nt("onload",fun ction(){alert(" Load event access from
page");},false) ;
and therefore create an event listener within my object rather than use the
image.onload event listener.
Thank you for your time. 1 2128
On Tue, 13 Mar 2007 19:47:45 +0100, webgour <ol***********@ hotmail.com
wrote:
Hello,
I would like to create an onload event within my object.
The following works fine :
function TEST()
{
this.image= new Image();
}
TEST.prototype. Initialize = function()
{
var _this = this;
this.image.onlo ad = function(){_thi s.Alerting("Ima ge Loaded");};
this.image.src = "winxp.gif" ;
}
TEST.prototype. Alerting = function(i_stri ng){alert(i_str ing);}
var mTest = new TEST();
mTest.Initializ e();
mTest.image.att achEvent("onloa d",function(){a lert("Load event access from
page");},false) ;
But i would rather be able to use :
mTest.attachEve nt("onload",fun ction(){alert(" Load event access from
page");},false) ;
and therefore create an event listener within my object rather than use
the
image.onload event listener.
Thank you for your time.
attachEvent() is a Microsoft proprietary function. It will work, but you
will be limiting yourself to Microsoft's attempt at a web browser only.
The standard method is addEventListene r(), but since the programmers of
the world's most used browser decided to implement their own proprietary
method, you won't have much use of the standard.
In these cases, falling back on the 'old' methods are best. So please,
continue to assign to image.onload. It might look less elegant, but it
beats the browser incompatilities .
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Da Costa Gomez |
last post by:
Hi all,
I've been eluded the last couple of *days* on the onload mystery within
the frame and function context.
Problem is as follows:
- frameset with two frames. One called scripts and the other called main
- scripts carries a bunch of js functions rechable via
parent.scripts.functioName()
- Main carries the html page that utilizes some functions
|
by: vadivasbro |
last post by:
Very simple code. Why won't this work?
<html>
<head>
<script type="text/javascript">
window.onload = document.getElementById("thisThing").style.background =
"red";
</script>
|
by: foldface |
last post by:
Hi
I am aware of how Page_Load and OnLoad work. What I am curious about is
-why- there are 2 mechanisms for doing the same thing, in particular why
Visual Studio will generate code to implement the Page_Load functionality
and not OnLoad.
When should either be used?
My guess is that because OnLoad should call the base.OnLoad method its
slightly cleaner using the Page_Load mechanism but that sounds a bit
naff.
|
by: Stephen Adam |
last post by:
Hi there,
I am developing a web site with a number of pages, I want each page to have
the same heading section which will include both the raw html and vb.net
code which handle rollovers for some images which will also be included.
My initial feeling on how to do this would be to create a base class web
page and then inherit it with all the HTML response.writing and image
rollover code already there. Problem being that my page already...
|
by: CES |
last post by:
All,
I was wondering if someone could point me to a tutorial on creating & accessing functions from within a wrapper function.
I've created a group of functions related to a timer event. All works well until I try to enclose these functions into a class like structure ie:
function dTimer(div){
//Insert the Javascript Code Below
startTimer();
}
| |
by: Andy Fish |
last post by:
Hi,
I have an asp.net web application which uses a pop-up form that works a bit
like a dialog box. when the user clicks "OK" it does a postback (basically a
form post if you don't know .net) to save the contents of the form, and then
I put an onload event to do a window.close.
this works fine for hundreds of people on different browsers. However, for
one user the window does not close.
|
by: ajfish |
last post by:
Hi,
I have a web form with smart navigation turned on. the html has an
onload event which calls a javascript function and the contents of this
function are dynamically generated on the server like this:
function onload() {
<% if (some_condition) { %>
do_some_javascript();
<% } %>
|
by: Daz |
last post by:
Hello everyone,
I would like to open a child window from the parent, and add an onload
event listener to the child window which will tell the parent when the
document has loaded. As far as I know, this shouldn't be an issue, but
I just can't get it to work. The script only needs to work with
Firefox/Mozilla, so XP code isn't an issue.
I have tried to open a window like so.
|
by: dd |
last post by:
Has anyone found a way around the problem IE has if you create elements
(script or div, doesn't seem to matter) BEFORE the document.readyState
is "complete" ?
I know you can sometimes get away with only waiting for "interactive"
state, but I've found that on some pages, that can result in a weird
error with a dialog box along the lines of "Internet operation aborted
error" (or something like that, I haven't seen it for a long time since...
|
by: Jason |
last post by:
Hi,
Here's the scenario:
I have a web application that has window A and window B.
A user has both window A and B open - window A is in the foreground and
window B is behind it.
If the user looking at window A clicks the "open window B" link, I want
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |