473,606 Members | 2,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: How to pass a parameter via an image.onload function call?

On Oct 23, 10:36 am, Tuxedo <tux...@mailina tor.comwrote:
How is it possible to pass a parameter via a function that runs upon onload
of an off-screen image? Like for example:

(...)

function first_function( PARAMETER){
preload_image = new Image(800,600);
preload_image.o nload = photo_preloaded (PARAMETER);
preload_image.s rc = 'images/photo.jpg';

}

function photo_preloaded (PARAMETER){
alert(PARAMETER )

}
(...)

Is is possible to run the second function only if the image has been
preloaded, with the parameter? If so, how would this be constructed?
Yes:

function first_function (PARAMETER) {
preload_image = new Image(800,600);
preload_image.o nload = function () { photo_preloaded (PARAMETER); };
preload_image.s rc = 'images/photo.jpg';
}

--
Jorge.
Oct 23 '08 #1
1 9331
Jorge wrote:
[..].
preload_image.o nload = function () { photo_preloaded (PARAMETER); };
Thanks for posting this snipped! I understand it uses a so-called function
literal, or unnamed function call. It works fine, and appears to be the
most straighforward solution specifically for what I'd like to achieve.
Oct 23 '08 #2

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

Similar topics

4
3101
by: andy | last post by:
i am coding a dll which contains a function take a const wchar_t* as parameter, call it form a exe, the wchar_t is passed to dll function, but the function in dll will then call another function and pass that wchar_t* parameter to another function, now the problem is that functions in dll, when exported function pass parameter another one(unexported), they both residen in the same dll, between wchar_t* passing, the target function can't...
1
10190
by: Adam Ratcliffe | last post by:
I'm trying to come up with a solution for detecting when an image, loaded by a script, has completely loaded. The Image.onload event is fired after the image has loaded in Firefox but before loading has completed in Internet Explorer. The function where I assign the onload event handler looks like this: var newImage = new Image(); function getImage(url) { var image = document.getElementById("theImg");
39
6511
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. When it completes, it can call a success, or a failure function. The names of these success, or failure functions will differ, and I'd like to know how I can pass the name of a function to my tool, and how my tool can call the function, using that...
5
1312
by: Lisa J. | last post by:
Heloe I would like to be able to pass a condition of an IF statement as parameter as follow aStr=” (A=1) and (B=2)” if aFunc(“aStr”) then …. End if
1
442
by: Falko Wagner | last post by:
Hi there, I am currently translating a VB 6.0 application to .NET and have the following problem: The data structure I need to pass to a DLL function call has a structure variable inside its structure: Private Structure CstData_type Dim Cst_AZ As DbLong
3
26745
by: jon | last post by:
Hello, I've had long standing code that runs in IE, that I'm testing with firefox unsuccessfully now. The problem seems to be that images that I dynamically create don't fire their onload event in firefox. The onload method I assign is never being called. Any ideas why firefox isn't calling this, or what I can do for a workaround? Below is approxiatemate code of what I'm doing...
1
11062
by: bharathv6 | last post by:
i need to do is modify the image in memory like resizing the image in memory etc ... with out saving it disk as i have to return back the image with out saving it disk PIL supports the use of StringIO objects being passed in place of file objects. StringIO objects are binary strings of variable length that are kept in memory so i saved the image in stringio objects the following code does that for gif image ...
3
2333
by: Davy | last post by:
Hi all, Sometimes I need to pass same parameter in recursive function. From my point of view, the style is redundant, and I don't what to use some global style like self.A, self.B, Is there any other choice? For example, def func(self, x, y, A, B, C): #x, y change in recursive call
6
1267
by: Janwillem Borleffs | last post by:
Tuxedo schreef: You can check the Image.complete property; example: img = new Image(100,100); interval = setInterval('checkcomplete()', 100); img.src = 'someimg'; function checkcomplete() { if (window.complete) {
0
8045
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8320
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 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...
0
6803
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 projectplanning, coding, testing, and deploymentwithout 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...
1
5994
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5470
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3952
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...
1
2458
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
1
1574
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1315
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.