且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

帮助解决一个简单问题

更新时间:2022-06-26 06:18:18

文章< MP ***************** *******@news.tc.umn.edu&gt ;,特里

< go ************** @ REMOVE.yahoo.com>写道:
In article <MP************************@news.tc.umn.edu>, Terry
<go**************@REMOVE.yahoo.com> writes:
这是一个新手的问​​题。我想预加载4张图片,只有当所有4张图片都加载到浏览器的缓存中时,我才想开始一个
幻灯片放映()功能。如果图像未完成加载到缓存中,幻灯片显示看起来不太好。

我不知道如何/何时调用slideshow()函数来确保它
This is a newbie''s question. I want to preload 4 images and only when
all 4 images has been loaded into browser''s cache, I want to start a
slideshow() function. If images are not completed loaded into cache,
the slideshow doesn''t look very nice.

I am not sure how/when to call the slideshow() function to make sure it
starts after the preload has been completed.




通过window.onload或body标签加载它:


window.onload = slideshow;


在脚本部分,或:


< body onload =" slideshow()" ;>


该页面不会被视为已加载直到图片也被加载。

-

兰迪



load it via the window.onload or in the body tag:

window.onload = slideshow;

in the script section, or:

<body onload="slideshow()">

The page will not be considered "loaded" until the images are loaded as well.
--
Randy



通过window.onload或body标签加载它:

window.onload = slideshow;

在脚本部分,或者:

< body onload =" slideshow()">

该页面不会被视为已加载直到图像加载为止。

load it via the window.onload or in the body tag:

window.onload = slideshow;

in the script section, or:

<body onload="slideshow()">

The page will not be considered "loaded" until the images are loaded as well.




兰迪,


我做了以上操作。但是,幻灯片开始在所有图像加载之前开始。


Terry



Randy,

I did the above. However, the slideshow starts before all the images
are loaded.

Terry


Terry写道:
Terry wrote:
通过window.onload或body标签加载它:

window.onload = slideshow;

在脚本部分,或:

< body onload =" slideshow()">

页面将不被视为 ;装载&QUOT;直到图像也被加载。
load it via the window.onload or in the body tag:

window.onload = slideshow;

in the script section, or:

<body onload="slideshow()">

The page will not be considered "loaded" until the images are loaded as well.



兰迪,

我做了以上的事情。但是,幻灯片开始在加载所有图像之前。

特里


Randy,

I did the above. However, the slideshow starts before all the images
are loaded.

Terry




< img src =" image1。 JPG&QUOT;宽度= QUOT 1 QUOT; height =" 1">

< img src =" image2.jpg"宽度= QUOT 1 QUOT; height =" 1">

< img src =" image3.jpg"宽度= QUOT 1 QUOT; height =" 1">

< img src =" image4.jpg"宽度= QUOT 1 QUOT;每个图片的高度=" 1">


等等。然后使用body的onload或window.onload来

开始幻灯片放映。


或者,你的预加载脚本有问题。如果您无法正常工作,请将URL发布到

样本页面。



<img src="image1.jpg" width="1" height="1">
<img src="image2.jpg" width="1" height="1">
<img src="image3.jpg" width="1" height="1">
<img src="image4.jpg" width="1" height="1">

and so on for each image. Then use the body''s onload or window.onload to
start the slideshow.

Or, something is wrong with your preloading script. Post a URL to a
sample page if you can''t get it working.