/    Sign up×
Community /Pin to ProfileBookmark

😮 I have this code for preload images, someone can help me with something short? Thanks Claudio

<!–
if (navigator.userAgent.substring(0,9) == “Mozilla/3”)
{
normal = new MakeArray(5)
over = new MakeArray(5)
picture = new MakeArray(5)
blurb = new MakeArray(5)

normal[1].src = “still/HOME_ARCH.GIF”
normal[2].src = “still/ex.GIF”
normal[3].src = “still/bio.GIF”
normal[4].src = “still/con.GIF”

over[1].src = “still/HOME_ARCH2.GIF”
over[2].src = “still/ex2.GIF”
over[3].src = “still/bio2.gif”
over[4].src = “still/con2.gif”

picture[1].src = “still/1.gif”
picture[2].src = “still/2.GIF”
picture[3].src = “still/3.GIF”
picture[4].src = “still/4.GIF”
picture[5].src = “still/5.GIF”

blurb[1] = “Artist archive/index.html”
blurb[2] = “Current Exhibitions”
blurb[3] = “Artist Biography”
blurb[4] = “Contact”
blurb[5] = “”

}

function MakeArray(n) {
this.length = n
for (var i = 1; i<=n; i++) {
this[i] = new Image()
}
return this
}

function msover(num) {
if (navigator.userAgent.substring(0,9) == “Mozilla/3”)
{

document.images[num+1].src = over[num].src
window.status = blurb[num]
document.images[6].src = picture[num+1].src
}
}

function msout(num) {
if (navigator.userAgent.substring(0,9) == “Mozilla/3”)
{
document.images[num+1].src = normal[num].src
document.images[6].src = picture[1].src
window.status = blurb[5]
}

}

// –>

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf(“#”)!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf(“?”))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//–>
</SCRIPT>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @tclaudio spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...