图片高宽取值原理问题? 先用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> js new date 如何用JAVAScript改变s:file的value值 选中复选框后能不能让其关联的label控件变色? 一个浮动DIV居中问题 一个简单的问题!如果给DropDownList加值!! 3*1.4怎么才能等于5.2呢? js载入flash时提示SCRIPT438: 对象不支持“flash”属性或方法 JS 数组问题 html页面上没有script标签,也没有“=”,如何执行一个alert(1) $.ajax为什么自定义的options无法传进去给回调???? 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>