网页中document.readyState几种状态 (下载完成等)及示例
来源:互联网 发布:堆优化的dijkstra 编辑:程序博客网 时间:2024/06/16 19:44
在delphi中也可以用IHTMLDocuemt2接口的readystate属性来判断,下面为转载内容
==============================document.readyState几种状态及示例
这个属性是只读的,传回值有以下的可能:
0-UNINITIALIZED:XML 对象被产生,但没有任何文件被加载。
1-LOADING:加载程序进行中,但文件尚未开始解析。
2-LOADED:部分的文件已经加载且进行解析,但对象模型尚未生效。
3-INTERACTIVE:仅对已加载的部分文件有效,在此情况下,对象模型是有效但只读的。
4-COMPLETED:文件已完全加载,代表加载成功。
范 例
alert("The readyState property is " + xmlDoc.readyState);
<script language="javascript">
if (document.readyState=="complete")
{
AdjustImageSize();
}
else
{
document.onreadystatechange = function()
{
if (document.readyState == "complete")
{
AdjustImageSize();
}
}
}
function AdjustImageSize()
{
var imageWidth = document.all["SendPic"].width;
var imageHeight = document.all["SendPic"].height;
if (imageWidth == 0 && imageHeight == 0)
{
document.write ("图片下载失败,请刷新!");
return;
}
if (imageWidth > 160 || imageHeight > 160)
{
if (imageWidth > imageHeight)
{
k = 160 / imageWidth;
imageHeight = imageHeight * k;
imageWidth = 160;
}
else
{
k = 160 / imageHeight;
imageWidth = imageWidth * k;
imageHeight = 160;
}
document.all["ImgResized"].value = "1";
}
document.all["SendPic"].width = imageWidth;
document.all["SendPic"].height = imageHeight;
document.all["ImgWidth"].value = imageWidth;
document.all["ImgHeight"].value = imageHeight;
}
</script>
if (document.readyState=="complete")
{
AdjustImageSize();
}
else
{
document.onreadystatechange = function()
{
if (document.readyState == "complete")
{
AdjustImageSize();
}
}
}
function AdjustImageSize()
{
var imageWidth = document.all["SendPic"].width;
var imageHeight = document.all["SendPic"].height;
if (imageWidth == 0 && imageHeight == 0)
{
document.write ("图片下载失败,请刷新!");
return;
}
if (imageWidth > 160 || imageHeight > 160)
{
if (imageWidth > imageHeight)
{
k = 160 / imageWidth;
imageHeight = imageHeight * k;
imageWidth = 160;
}
else
{
k = 160 / imageHeight;
imageWidth = imageWidth * k;
imageHeight = 160;
}
document.all["ImgResized"].value = "1";
}
document.all["SendPic"].width = imageWidth;
document.all["SendPic"].height = imageHeight;
document.all["ImgWidth"].value = imageWidth;
document.all["ImgHeight"].value = imageHeight;
}
</script>
- 网页中document.readyState几种状态 (下载完成等)及示例
- document.readyState几种状态及示例
- 原生ajax请求及readyState的几种状态
- document.readyState等属性
- document.readyState等属性
- document.readyState等属性
- xmlHttp.readystate的几种状态
- ajax方法XHR.readyState五种状态与示例
- Ajax中HttpRequest中status及readyState状态值
- ajax readyState五种状态及status状态码
- js中常用方法以及document.readyState 判断页面是否加载完成 complete和interactive
- document.readyState
- readyState五中状态详解
- readyState的五种状态
- readyState的五种状态
- readyState的五种状态
- readyState 5种状态(Ajax)
- readyState的五种状态
- C#自身包含其他应用程序(或者文件)并在运行时调用
- 【部门管理入门-1】软件部技术管理纲要
- Eclipse安装SVN支持详解
- Linux/Window 7 Telnet 配置(二)
- Java中==与equals的区别
- 网页中document.readyState几种状态 (下载完成等)及示例
- ARM编程进阶之一 —— ARM汇编伪指令
- 细观Google全面大揭秘
- 正则表达式 基础认识
- 那个允许挥霍的年代叫青春
- 网络工具集线器、交换机、路由器和网关
- 使用IDirectDrawClipper进行裁剪
- iOS5编程 -- main函数研究
- SQL server2005 restore数据报错