Is the correct way to preload this image below?
I have a table that changes the background once 'Choose Options' has changed. In the body of my page, I have this:
& lt; Body onload = "preload ();" & Gt;
and in my form on the same page:
& onchange = "swap ();" & Gt; & Lt; Option bla bla & gt; ; & Lt; / Select & gt;
and JS:
function preload () {image = new image (720, 65); Pic.src = '../picture.jpg'; } Function swap () {document.getElementById ("table_id_here"). Style.backgroundImage = '../picture.jpg'; }
function in swap () I think the picture. The JPG file has already been loaded already, right?
Really Cached (Preloaded)?
Thanks
Use something like Firebug's network device
I think your code should work, however it is a popular script that has been used for Dreamweaver image preloading:
function MM_preloadImages () {// v3.0 var d = document; If (D. Ingers) {if (! D.MM_p) d.MM_p = New Array (); Var i, j = d.mm_p.length, a = MM_preloadImages.arguments; For (i = 0; i & lt; a.length; i ++) if (a [i] .indexOf ("#")! = 0) {d.MM_p [j] = new image; D.MM_p [j ++] Src = a [i];}}} MM_preloadImages ('img1.gif', 'img2.gif'); // Add more if necessary
No comments:
Post a Comment