DJRobThaMan
07-24-2003, 10:32 AM
I was just wondering. Do you think you can use javascript to preload a page?
For example, you make the index something like
<html>
<head>
<script language="JavaScript">
<!--
var images = newArray();
var i = 0;
images[i] = document.pic + i + .src;
++i;
// I can't remember how to cache images offhand. I know it's something like this. I have the code on my computer but I'm at work right (yeah I know I'm a slacker but hey... )
function gotorealindex(){
preload = setInterval("a function where I have something moving to show the page is loading",20);
}
function the one being cleared(){
blahblahblah(code for animation);
if(i == 10){
//assuming there are 11 images
clear Interval(preload);
document.location = index location(wherever that is);
}
-->
</script>
</head>
<body>
<img src....>
</body>
</html>
Do you think the images would load with the first page so the real index would just kinda pop up really quickly... or not?
Tell me what you think
For example, you make the index something like
<html>
<head>
<script language="JavaScript">
<!--
var images = newArray();
var i = 0;
images[i] = document.pic + i + .src;
++i;
// I can't remember how to cache images offhand. I know it's something like this. I have the code on my computer but I'm at work right (yeah I know I'm a slacker but hey... )
function gotorealindex(){
preload = setInterval("a function where I have something moving to show the page is loading",20);
}
function the one being cleared(){
blahblahblah(code for animation);
if(i == 10){
//assuming there are 11 images
clear Interval(preload);
document.location = index location(wherever that is);
}
-->
</script>
</head>
<body>
<img src....>
</body>
</html>
Do you think the images would load with the first page so the real index would just kinda pop up really quickly... or not?
Tell me what you think