你能检测出是否加载了图像吗? [英] Can you detect if an image is loaded?

查看:78
本文介绍了你能检测出是否加载了图像吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使使用预加载滚动等,

屏幕上使用的第一组图像仍然需要加载才能看到它们。所以,我被问到我可以显示短信''loading ...'',同时还有很多图像 - 3或

4 -load在索引页面上(我个人会使用较小的图像,但....)。


理想情况下我正在寻找解决方案 - 如果有一个可行的话与

Mac NN4.7和Mac IEv5.x.


可能吗?


问候


马克


Even with preloading roll-overs etc, the first set of images used on
screen still have to load before they can be seen. So, I''ve been asked I
can to show a text message ''loading...'' while a number of images - 3 or
4 -load on an index page (personally I''d use smaller images, but....).

Ideally I''m looking for a solution- if there is one that will work with
Mac NN4.7 and Mac IEv5.x.

Possible?

Regards

Mark


推荐答案

2004年6月16日星期三18:00:51 + 0100,Mark Anderson< ma ** @ notmeyeardley.demon.co.uk>写道:
On Wed, 16 Jun 2004 18:00:51 +0100, Mark Anderson <ma**@notmeyeardley.demon.co.uk> wrote:
即使有预加载滚动等,
屏幕上使用的第一组图像仍然必须加载才能看到它们。所以,我被问到我可以在索引页面上显示一些短信''loading ...'',同时还有一些图片 - 3或
4 -load '使用较小的图像,但....)。

理想情况下我正在寻找一个解决方案 - 如果有一个可以使用
Mac NN4.7和Mac IEv5 .x。

可能吗?

问候

马克
Even with preloading roll-overs etc, the first set of images used on
screen still have to load before they can be seen. So, I''ve been asked I
can to show a text message ''loading...'' while a number of images - 3 or
4 -load on an index page (personally I''d use smaller images, but....).

Ideally I''m looking for a solution- if there is one that will work with
Mac NN4.7 and Mac IEv5.x.

Possible?

Regards

Mark



马克,这里是一个想法...

var preloadImgCount = 10;

var preloadImgObjs = new Array();


window.onload =功能()

{

//显示启动画面

//在此处或在onload之前预加载图像

preloadImgWait (); //等待图片加载

}


函数preloadImgWait()

{

var i,c = 0;

for(i = 0; i< preloadImgCount; ++ i){

if(preloadImgObjs [i] .complete)++ c ;

}

window.status =''图片已加载:''+ c +''''+ preloadImgCount;

if( c == preloadImgCount){

window.status ='''';

appInit();

}

else setTimeout(" preloadImgWait()",500);

}


函数appInit()

{

//隐藏启动画面

//启动应用程序

}


Hi Mark, here''s an idea...
var preloadImgCount = 10;
var preloadImgObjs = new Array();

window.onload = function()
{
// display splash screen
// preload images here or before onload
preloadImgWait(); // wait for images to load
}

function preloadImgWait()
{
var i, c=0;
for (i = 0; i < preloadImgCount; ++i) {
if (preloadImgObjs[i].complete) ++c;
}
window.status = ''Images Loaded: '' + c + '' of '' + preloadImgCount;
if (c == preloadImgCount) {
window.status = '''';
appInit();
}
else setTimeout("preloadImgWait()", 500);
}

function appInit()
{
// hide splash screen
// start application
}




Mike Foster < MI ******** @ mfosternospam.com>在消息中写道

news:op ************** @ news.charter.net ...

"Mike Foster" <mi********@mfosternospam.com> wrote in message
news:op**************@news.charter.net...
6月16日星期三2004 18:00:51 +0100,Mark Anderson
< ma ** @ notmeyeardley.demon.co.uk>写道:
嗨Mark,这是一个想法...

var preloadImgCount = 10;
var preloadImgObjs = new Array();

window.onload = function()
//
//显示启动画面
//在此处或在onload之前预加载图像
preloadImgWait(); //等待图片加载


函数preloadImgWait()
{var /> var i,c = 0;
for(i = 0; i< preloadImgCount; ++ i){
if(preloadImgObjs [i] .complete)++ c;
}
window.status =''图片已加载:''+ c + ''of''+ preloadImgCount;
if(c == preloadImgCount){
window.status ='''';
appInit();
}
else setTimeout(" preloadImgWait()",500);


函数appInit()
//
//隐藏启动画面
/ / start application
}
On Wed, 16 Jun 2004 18:00:51 +0100, Mark Anderson <ma**@notmeyeardley.demon.co.uk> wrote:
Hi Mark, here''s an idea...
var preloadImgCount = 10;
var preloadImgObjs = new Array();

window.onload = function()
{
// display splash screen
// preload images here or before onload
preloadImgWait(); // wait for images to load
}

function preloadImgWait()
{
var i, c=0;
for (i = 0; i < preloadImgCount; ++i) {
if (preloadImgObjs[i].complete) ++c;
}
window.status = ''Images Loaded: '' + c + '' of '' + preloadImgCount;
if (c == preloadImgCount) {
window.status = '''';
appInit();
}
else setTimeout("preloadImgWait()", 500);
}

function appInit()
{
// hide splash screen
// start application
}




谢谢。我需要''加载消息''出现在

图像的某些位置。最好的想法 - 给定NN4是在循环中 - 使用

绝对定位div并设置隐藏当图像

被加载时隐藏?
<问候


Mark



Thanks. I need the ''loading message'' to appear where (some of) the
images will be. Would the best idea - given NN4 is in the loop - to use
an absolutely positions div and set visibility to hidden when the images
are loaded?

Regards

Mark


Mark Anderson说:
Mark Anderson said:

...
谢谢。我需要''加载消息''出现在(某些)
图像的位置。最好的想法 - 给定NN4是在循环中 - 使用
一个绝对的位置div ...


可能有很多不同的方法来做,但是这是一种可以在NN4中运行的方法。


Mark Anderson说:......并且在加载图像时将隐藏可见性设置为隐藏? /> ...

...
Thanks. I need the ''loading message'' to appear where (some of) the
images will be. Would the best idea - given NN4 is in the loop - to use
an absolutely positions div...
There''s probably many different ways to do it, but that is an approach
that would work in NN4.

Mark Anderson said: ...and set visibility to hidden when the images are loaded?
...




设置" element.visibility =''hide''" (对于NN4,对于符合DOM的浏览器

使用" element.style.visibility =''hidden''")是可选的,因为你仍然必须

移动NN4的屏幕外元素 - 否则它仍然会收到鼠标

事件,即使它不可见。



Setting "element.visibility=''hide''" (for NN4, for DOM-compliant browsers
use "element.style.visibility=''hidden''") is optional because you must still
move the element off-screen for NN4 - otherwise it will still receive mouse
events even tho it is not visible.


这篇关于你能检测出是否加载了图像吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆