图片高宽取值原理问题? 先用hidden存好没有缩小的width,height 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 offset和img.width,看示例<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> - http://www.never-online.net </title> <meta http-equiv="ImageToolbar" content="no" /> <meta name="author" content="never-online, BlueDestiny"/> </head> <body id="www.never-online.net"><img src="http://zi.csdn.net/ren760-ok_3.gif" id="p" style="border:2px solid #000" onload="loadp(this)"/> <script type="text/javascript"> //<![CDATA[function loadp(img) {var w=img.width;var h=img.height;var w2=img.offsetWidth;var h2=img.offsetHeight;alert("offset:"+w2)alert("img"+w)} //]]> </script> </body></html> 如果这个200*200的图片被zoom{zoom:0.75}缩放用DOM取得此图片的zoom值(object.style.zoom)再用img.width*zoom值即可 <img src="....." onload="loadimg(this)"/> <script type="text/javascript">function loadimg(theimg) { var image=new Image(); image.src=theimg.src; //image.width>0,image.height既为原图尺寸 alert(image.width); alert(image.height);} </script> <img src="....." onload="loadimg(this)"/> <script type="text/javascript">function loadimg(theimg) { var image=new Image(); image.src=theimg.src; //image.width,image.height既为原图尺寸 alert(image.width); alert(image.height);} </script> 编写高性能JavaScript 散分,标题要BUG,你们这样才肯进来o(╯□╰)o appendChild引起的parentNode问题,请教 请教JS中控件属性style.display='' 与style.display='none' 的区别 在safari浏览器下,用javascript怎么改变标签的长度? 把网页另存为后是保存到硬盘里? 好久没来了,孟子老兄哪去了? 为什么这么多的‘’“”??????? 求教JS高手:这是怎么回事? 请问出错在那啊 javascript自动生成计算问题,高手来答 javascript提交表单内容的问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> - http://www.never-online.net </title>
<meta http-equiv="ImageToolbar" content="no" />
<meta name="author" content="never-online, BlueDestiny"/>
</head>
<body id="www.never-online.net">
<img src="http://zi.csdn.net/ren760-ok_3.gif" id="p" style="border:2px solid #000" onload="loadp(this)"/>
<script type="text/javascript">
//<![CDATA[
function loadp(img) {
var w=img.width;
var h=img.height;var w2=img.offsetWidth;
var h2=img.offsetHeight;
alert("offset:"+w2)
alert("img"+w)
}
//]]>
</script>
</body>
</html>
<script type="text/javascript">
function loadimg(theimg) {
var image=new Image();
image.src=theimg.src;
//image.width>0,image.height既为原图尺寸
alert(image.width);
alert(image.height);
}
</script>
<script type="text/javascript">
function loadimg(theimg) {
var image=new Image();
image.src=theimg.src;
//image.width,image.height既为原图尺寸
alert(image.width);
alert(image.height);
}
</script>