validate.php是生成图片的页面(随机变化),change_validate()点击触发后,validate.php刷新后重新载入。
var change=document.getElementById('validate_pc')
alert(change)
change.src="validate.php"
(1)方法 1 <script type="text/javascript ">var obj=new Image()obj.src="http://www. phpernote.com/uplo adfiles/editor/20110 7240502201179.jpg"obj.onload=function(){ alert('图片的宽度为: '+obj.width+'图片的 高度为:'+obj.height)document.getElemen tById("mypic").innner HTML="<img src='"+this.src+"' />"
}
</script>
<div id="mypic">onloadi ng......</div>
方法 2
<script type="text/javascript ">
var obj=new Image()obj.src="http://www.phpernote.com/uploadfiles/editor/201107240502201179.jpg"
obj.onreadystatechange=function(){ if(this.readyState==" complete") alert('图片的宽度为: '+obj.width+'图片的 高度为:'+obj.height)document.getElementById("mypic").innner HTML="<img src='"+this.src+"' />"
}
}
</script>
<div id="mypic">onloadi