hur gör jag en delay lr liknande så att bilden hinner laddas in först i följande script?
<script language="JavaScript">
var picWin = null;
function showPic(pic, title){
if (picWin && !picWin.closed) picWin.close();
pageDoc = '<html><head><title>'+title+'</title></head>';
pageDoc += '<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">';
pageDoc += '<A href="java script:window.close()"><img border=0 src="'+pic+'" alt="'+title+'"></a>';
pageDoc += '</body></html>';
thePic = new Image();
thePic.src = pic;
attr = 'width=' + thePic.width;
attr += ', height=' + thePic.height;
attr += ', left=' + (screen.availWidth/2 - thePic.width/2);
attr += ', top=' + (screen.availHeight/2 - thePic.height/2);
picWin = window.open('', 'picWin', attr);
picWin.document.write(pageDoc);
}
</script>
<a href="java script:showPic('thepic.gif', 'My Title')">Here</a>