我加了
Img.src = TargetSrc;
Img.border=0;
alert("2");
发现一真alert(2)
也就是说XMLimg.Load事件一直执行着
这是怎么回事呢
Img.src = TargetSrc;
Img.border=0;
alert("2");
发现一真alert(2)
也就是说XMLimg.Load事件一直执行着
这是怎么回事呢
解决方案 »
- 用过thickbox的高手来指点一下
- 求正则表达式
- 一个处理form表单的语句.
- JavaScript通过ID获取DIV中的全部链接 在每个link点击时 修改href地址
- 两个表单中的js执行问题
- 如何用window.open弹开一个窗口,让新窗口最大化?
- 如何滤去字符串中汉字之间的空格?
- 要救只能输入数字?整型数字?在1900-2004之间的整型数字?如何写?
- ■■请教:TABLE操作问题,可能又要高手出马了,TD中内容换成图片,如何获得该图片的srcElement.name?请看例子:■■
- 异步加载js文件,在IE11下不行,请问怎么能兼容11?
- 请问几个HTML编辑器中插入图片的问题
- 关于数据解析的问题,可能需要用到正则表达式
难道onload不是执行一定,而是一直执行吗
{
alert("0");
if(typeof(Width) != "undefined" && typeof(Height) != "undefined")
{
//this.AutoSize(Img,Width,Height);
}
ImgObj.parentNode.insertBefore(Img, ImgObj);
ImgObj.parentNode.removeChild(ImgObj);
}
感觉你这段是多余的,都有onload的函数,还要这个干什么?
<img src="http://www.yy-sports.com/crocs/images/load.gif" onload="alert('')" />
先不管这个问题
现在
如何让
<img src="http://www.yy-sports.com/crocs/images/load.gif" onload="alert('')" />
的onload执行一次
----------
还真的是啊但我一定在用gif啊
那怎么让onload只执行gif最后一帧呢谢谢
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
无标题页
</title>
<script type="text/javascript">
var LoadCount = 0;
var XMLimg = {
// 动态加载图片 ***************************************************************
Load:function (ImgObj, TargetSrc, DefaultSrc, Width, Height)
{
var Img = new Image();
Img.src = TargetSrc;
Img.border=0;
if(Img.complete)
{
alert("0");
if(typeof(Width) != "undefined" && typeof(Height) != "undefined")
{
//this.AutoSize(Img,Width,Height);
}
ImgObj.parentNode.insertBefore(Img, ImgObj);
ImgObj.parentNode.removeChild(ImgObj);
}
Img.onload = function()
{
alert("1");
if(typeof(Width) != "undefined" && typeof(Height) != "undefined")
{
//XMLimg.AutoSize(Img,Width,Height);
}
ImgObj.parentNode.insertBefore(this, ImgObj);
ImgObj.parentNode.removeChild(ImgObj);
}
Img.onerror = function()
{
Img.src=DefaultSrc;
}
}
} </script>
</head>
<body>
<form name="form1" method="post" action="Default.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGTbKKzppo8+8eZbgzBgwJoKaEk1Cw==" />
</div> <img src="http://www.yy-sports.com/crocs/images/load.gif" onload="if( ++LoadCount == 1) XMLimg.Load(this,'http://zi.csdn.net/560×95.gif','http://www.csdn.net/Images/logo_csdn.gif',200,100)" /> </form>
</body>
</html>
这个与你内部的那个程序有关
var Img = new Image();
Img.src = TargetSrc;
Img.border=0;
这里重加载了
onload(this.onload=null,...)