这个功能如何运作? [英] how does this function work?

查看:74
本文介绍了这个功能如何运作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


有人可以解释这个预装图像功能是如何工作的吗?


这是

图片[ig] .onload = preload_imgs;


我不明白。


谢谢


Geoff

var ig = 0;


函数preload_imgs()

{

picture [ig] = new Image();

picture [ig] .onload = preload_imgs;

picture [ig] .src =" PIC" + ig +" .jpg";

ig ++;

}


preload_imgs();

解决方案

Geoff Cox写道:

你好,


你好,


你有没有回到你的页面spa.htm的最后更正?
http://perso.wanadoo.fr/stephane.moriaux/truc/spa.htm

我可以从我的网站上删除它吗?

有人可以解释一下这个预装图像功能是如何工作的吗?


你试过吗?

它有用吗?

这是

图片[ ig] .onload = preload_imgs;

我不明白。



//开始索引

var ig = 0;


//数字最大图像

var ig_max = 7;


函数preload_imgs()

{

if(ig< ig_max)

{

//这是一个了不起的新形象!

图片[ig] =新图片();

图片[ig] .onload = preload_imgs;

图片[ig] .src =" pic" ; + ig +" .jpg";

ig ++;

}

}


preload_imgs ();

-

Stephane Moriaux et son [moins] vieux Mac


你好,

你最后修正了你的页面spa.htm吗?
http://perso.wanadoo.fr/stephane.moriaux/truc/spa.htm

我可以从我的网站上删除它吗?

有人可以解释一下这个预装图像功能是如何工作的吗?



你试过吗?

它有用吗?

这是

picture [ig] .onload = preload_imgs;

我不明白。




这个例子中有一个错误!

//开始索引

var ig = 0;


//数字最大图像

var ig_max = 7;


函数preload_imgs()

{

if(ig< ig_max)

{

//何!多么奇妙的新形象!

picture [ig] = new Image();


//在这个新图像上加载(存储在缓存中)

//启动函数:preload_imgs()

//(注意:没有括号!)

picture [ig] .onload = preload_imgs;


//也许获得这个新形象的路径

//会有所帮助吗?

picture [ig] .src =" ; PIC" + ig +" .jpg";


//增加指数

ig ++;

}

//功能结束

//如果需要,是时候重新启动它

//仅在图像加载完成时触发

//与body标签中的'onload'完全相同

}


//达到最大索引时

//函数preload_imgs()的循环停止


//在javascript readind期间启动预编码图像

preload_imgs();


2005年9月17日星期六12:46:32 + 0200,ASM

< st ************** *******@wanadoo.fr.invalid>写道:

你好,

你有没有得到你的页面spa.htm的最后更正?
http://perso.wanadoo.fr/stephane.moriaux/truc/spa.htm
我可以从我的网站上删除它吗?


您好Stephane!


是的我diid - 非常感谢。请立即删除。

你试过吗?
有效吗?


现在不太确定!请试试下面的代码!


干杯


Geoff

它是

图片[ig] .onload = preload_imgs;

我不明白。



有一个这个例子中的错误!

//起始索引
var ig = 0;

//数字最大图像
var ig_max = 7;

函数preload_imgs()
{
if(ig< ig_max)
// 图片[ig] =新图片();
//在这个新图片上加载(存储在缓存中)
//启动功能:preload_imgs( )
//(注意:没有括号!)
图片[ig] .onload = preload_imgs;

//也许获取这个新图像的路径
//会有一些帮助吗?
picture [ig] .src =" pic" + ig +" .jpg";

//增加索引
ig ++;
}
//功能结束
//它''如果需要,重新启动它的时间
//仅在图像加载完成时才会触发
//与正文标签中的onload完全相同
}

//当达到最大索引时
//循环函数preload_imgs()停止

//在javascript readind期间启动预编码图像
preload_imgs();




Hello,

Can someone please explain how this preload images function works?

It is the

picture[ig].onload = preload_imgs;

which I don''t understand.

Thanks

Geoff
var ig = 0;

function preload_imgs()
{
picture[ig] = new Image();
picture[ig].onload = preload_imgs;
picture[ig].src = "pic" + ig + ".jpg";
ig++;
}

preload_imgs();

解决方案

Geoff Cox wrote:

Hello,
Hello,

did you get back last correction of your page spa.htm ?
http://perso.wanadoo.fr/stephane.moriaux/truc/spa.htm
May I delete it from my site ?
Can someone please explain how this preload images function works?
Did you try it ?
Does it work ?
It is the

picture[ig].onload = preload_imgs;

which I don''t understand.


// starting index
var ig = 0;

// number max images
var ig_max = 7;

function preload_imgs()
{
if(ig < ig_max)
{
// Ho the marvelous new image !
picture[ig] = new Image();
picture[ig].onload = preload_imgs;
picture[ig].src = "pic" + ig + ".jpg";
ig++;
}
}

preload_imgs();
--
Stephane Moriaux et son [moins] vieux Mac


Hello,

did you get back last correction of your page spa.htm ?
http://perso.wanadoo.fr/stephane.moriaux/truc/spa.htm
May I delete it from my site ?

Can someone please explain how this preload images function works?

Did you try it ?
Does it work ?
It is the

picture[ig].onload = preload_imgs;

which I don''t understand.



There was an error in this example !
// starting index
var ig = 0;

// number max images
var ig_max = 7;

function preload_imgs()
{
if(ig < ig_max)
{
// Ho! What marvelous new image !
picture[ig] = new Image();

// on this new image loaded (stored in cache)
// launch function : preload_imgs()
// (notice : NO parenthesis !)
picture[ig].onload = preload_imgs;

// perhaps path to get this new image
// would be of some help ?
picture[ig].src = "pic" + ig + ".jpg";

// increase index
ig++;
}
// end of function
// it''s time to re-launch it if needed
// fires only if image loading is finished
// works exactly as ''onload'' in body tag
}

// when max index is reached
// loop of function preload_imgs() stops

// to launch preloding images during javascript readind
preload_imgs();


On Sat, 17 Sep 2005 12:46:32 +0200, ASM
<st*********************@wanadoo.fr.invalid> wrote:

Hello,

did you get back last correction of your page spa.htm ?
http://perso.wanadoo.fr/stephane.moriaux/truc/spa.htm
May I delete it from my site ?
Hi Stephane!

Yes I diid - thanks alot. Please do remove it now.
Did you try it ?
Does it work ?
Not too sure now ! Will try out your code below!

Cheers

Geoff

It is the

picture[ig].onload = preload_imgs;

which I don''t understand.



There was an error in this example !
// starting index
var ig = 0;

// number max images
var ig_max = 7;

function preload_imgs()
{
if(ig < ig_max)
{
// Ho! What marvelous new image !
picture[ig] = new Image();

// on this new image loaded (stored in cache)
// launch function : preload_imgs()
// (notice : NO parenthesis !)
picture[ig].onload = preload_imgs;

// perhaps path to get this new image
// would be of some help ?
picture[ig].src = "pic" + ig + ".jpg";

// increase index
ig++;
}
// end of function
// it''s time to re-launch it if needed
// fires only if image loading is finished
// works exactly as ''onload'' in body tag
}

// when max index is reached
// loop of function preload_imgs() stops

// to launch preloding images during javascript readind
preload_imgs();




这篇关于这个功能如何运作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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