Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Q on 'new Image ()'
- From: javascript@xxxxxxxxxx (Walter Torres)
- Subject: [Javascript] Q on 'new Image ()'
- Date: Thu, 18 Oct 2001 17:29:20 -0500
For example...
var objImgBtn = new Array ( 2 ); // make an array
objImgBtn.up = new Image ( 24, 12 ); // .up is an IMAGE Object
objImgBtn.up.src = "./images/button-up.gif"; // source to an image
objImgBtn.dn = new Image ( 24, 12 ); // .dn is an IMAGE Object
objImgBtn.dn.src = "./images/button-dn.gif"; // source to an image
<img src='' width='24' height='12' id='myBtn'>
<div id='myBtn2'></div>
Now I have 2 images in local cache, an image on a page and a DIV.
document.all.myBtn.src = objImgBtn.dn.src;
Now the down button image from the array Object is in the <IMG> object.
document.all.myBtn2.style.backgroundImage = objImgBtn.dn.src;
document.all.myBtn2.style.backgroundImage.src = objImgBtn.dn.src;
Neither line works!
document.all.myBtn2.style.backgroundImage = "./images/button-dn.gif";
This does work, but it doesn't take advantage of the cached images.
Anybody have any ideas on how to have the DIV (or SPAN, for that matter)
take advantage the cached images in the 'objImgBtn' Object?
Thanks
Walter
- Follow-Ups:
- [Javascript] closing child windows
- From: Lau
- [Javascript] closing child windows
- Prev by Date: [Javascript] Re: Opening file in another app
- Next by Date: [Javascript] Re: Opening file in another app
- Previous by thread: [Javascript] Re: Opening file in another app
- Next by thread: [Javascript] closing child windows
- Index(es):