473,395 Members | 1,539 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,395 software developers and data experts.

Preload Image in Docwrite

I'm looking for an example of using a single preloaded image, where a
few images are loaded in a document.write.

Can anyone help with a simple example (as I'm still a novice in
javascript).

TIA
Bruce
Jul 20 '05 #1
3 1360
Bruce wrote on 16 feb 2004 in comp.lang.javascript:
I'm looking for an example of using a single preloaded image, where a
few images are loaded in a document.write.

Can anyone help with a simple example (as I'm still a novice in
javascript).


You cannot load something "in" a document.write.

What is the purpose of your quest?

Perhaps you can refrase youe question?

document.write is mostly only useful when the setup(!) of a page should be
dynamic. Dynamic image preloading does not need document.write.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
"Evertjan." <ex**************@interxnl.net> wrote in message news:<Xn********************@194.109.133.29>...
You cannot load something "in" a document.write.
What is the purpose of your quest?
Perhaps you can refrase youe question?
document.write is mostly only useful when the setup(!) of a page should be
dynamic. Dynamic image preloading does not need document.write.


I have a working page that uses a mapped image. When the user presses
one of the mapped areas (call them buttons), in some instances another
image (one of a few) is displayed (using a style sheet) and some text
appears (also using a style sheet). The trouble that the text appears
before the image, and that is why I need to preload those image(s), so
both appear at the same time. I am using document.write(s) to display
the second image (one of a few) and its accompanying text.

Bruce
Jul 20 '05 #3
Bruce wrote on 18 feb 2004 in comp.lang.javascript:
I am using document.write(s) to display
the second image (one of a few) and its accompanying text.


You cannot use document.write when the page is finished without destroying
the finished page and its script.

So better change the src or the innerHTML of a finished container:

<button onclick="document.getElementById('ImgPos').src='/img/New.jpg'">
change image</button>

<img src='/img/Old.jpg' id="ImgPos">

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #4

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

Similar topics

7
by: MALdito | last post by:
hi everybody let me say right from the start .. I´m not a coder ... "just" a designer! that said .. here is my question: I´m using dreamweaver´s built in preloader for a menu. it looks like...
3
by: Bob | last post by:
I usually use some "pre-load" code in my pages to preload graphics that will be swapped. But, I'm thinking that rather than the long, repetitive, once, for each graphic hardcoded stuff like this: ...
2
by: jmhill | last post by:
Has anyone else had this issue? Basically, the preload of images for a rollover effect for the navigation is really really slow when using IE 6.0 but when i view the site using Netscape, it's fast...
2
by: Albert Spencil | last post by:
I have tried several preload scripts found here; plus, some of my own. The only thing that works is the unsophisticated loading of those tiny images. The download consist of 100+ images amounting...
1
by: Peter Fastré | last post by:
Hello The javascript preload function I always used, is causing problems with the latest version of gecko-browsers. Never had any problems with it though. Maybe there's something wrong? ...
3
by: misdst23 | last post by:
Hi, I would like to use the preload feature to transmit data from the client to the server. I use the SRC attribute of the image to compose the URL and transmit the info. How can i do this? Any...
4
by: shapper | last post by:
Hello, I think to preload an image I should us something like: img = new Image(); img.src = 'images/img.jpg'; Could someone tell me how to create a loop which would preload a list of...
2
by: =?Utf-8?B?Q2FzcGE=?= | last post by:
Is there any way to preload an image returned by an HTTP Handler? My image HTTP handler is generating some thumbnails that I want to preload. thanks Caspa
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
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...
0
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...

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.