Jump to content

Preloading images


Akasha
 Share

Recommended Posts

Hello i am making a website.In my header there are images and they are static.Only sometimes when a project is choosen the associated picture wil get a border.did that with asp(code will follow)But when you press a link it takes a long time before the header is finished loading the images, so i got a preloading script from the internet.But i have this feeling i just can't get it to work, what am i doing wrong? :) Code for preloading images

<script language="JavaScript" type="text/JavaScript"><!--   function preloadImages() {  var d=document; if(d.images){ if(!d.p) d.p=new Array();    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}} --> </script>

My body tag

<body topmargin="8" onLoad="preloadImages('fotologo/53984 .JPG','fotologo/mosccryst2 copy.jpg','fotologo/DSC_1061adv.jpg', 'fotologo/DSC_0054.jpg','fotologo/neonkunstwerk_Asten.jpg','fotologo/DSC_0026i.jpg','background.gif','logo4.jpg')">

an finally the code who places the images on the screen, i used asp so that when a particular project is chosen, a border is shown around the images which is associated.

<table bgcolor="#000000" cellpadding="7px"  class="borders">   <tr class="borders">      <td width="15%" align="right"><img src="logo4.jpg" height="75"></td>      <%        if request("project") = "gro" then           response.Write("<td><img class='borderpic' src='fotologo/53984 .JPG' height='74'></td>")        else          response.Write("<td><img src='fotologo/53984 .JPG' height='74'></td>")        end if        if request("project") = "mos" then           response.Write("<td><img class='borderpic' src='fotologo/mosccryst2 copy.jpg' height='74'></td>")        else          response.Write("<td><img src='fotologo/mosccryst2 copy.jpg' height='74'></td>")        end if        if request("project") = "rijs" then           response.Write("<td><img class='borderpic' src='fotologo/DSC_1061adv.jpg' height='74'></td>")        else          response.Write("<td><img src='fotologo/DSC_1061adv.jpg' height='74'></td>")        end if        if request("project") = "kerk" then           response.Write("<td><img class='borderpic' src='fotologo/DSC_0054.jpg' height='74'></td>")        else          response.Write("<td><img src='fotologo/DSC_0054.jpg' height='74'></td>")        end if        if request("project") = "ast" then           response.Write("<td><img class='borderpic' src='fotologo/neonkunstwerk_Asten.jpg' height='74'></td>")        else          response.Write("<td><img src='fotologo/neonkunstwerk_Asten.jpg' height='74'></td>")        end if        if request("project") = "lei" then           response.Write("<td><img class='borderpic' src='fotologo/DSC_0026i.jpg' height='74'></td>")        else          response.Write("<td><img src='fotologo/DSC_0026i.jpg' height='74'></td>")        end if      %>    </tr>  </table>

Perhaps i want to preload to many images or does the preload script en the asp not work together. :) What is wrong and what can i do about it?thanx in advance :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...