|M| <img src="1.jpg">当这个图片的宽度大于浏览器的时候浏览器就自动将我的图片缩小了,我不想要怎么办 <img src="1.jpg">当这个图片的宽度大于浏览器的时候浏览器就自动将我的图片缩小了,我不想要怎么办如<img src='1.jpg' alt='' />当我的图片的宽度为2000这么大的时候浏览器就自动将他缩小浏览器的适应大小要怎么办 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <img src='1.jpg' alt='' height="768" width="1024"/>Height图片高度width图片宽度; 指定大小.style="width:??;height:??? <img> 里 把 width 和 height 写死 只要 你指定image的 width 和 height 的值就可以避免你遇到的问题! 向上面各位说的,把图片大小指定,如果要宽度不变,高度变的话就只指定width 当这个图片的宽度大于浏览器的时候浏览器就自动将我的图片缩小了?应该是IE设置自动 缩小那么打开IE 设置 高级 启用自动图像大小调整 去掉! 即可如不是 可写死width height 楼主好象不是这个意思 我替楼主说明一下他的图片应该是不固定的 有时候小于浏览器宽度 如 width:200px 应200px显示大于浏览器宽度时候 如 2000px 也应按实际宽度显示 2000px如果设置固定宽度的话 就把小于2000px的图片拉伸了 可以动态给IMG的width 和 height赋值 对IE说:"不要......":D,开个玩笑用一个Image对像读到图片的W H,然后设置<img 的 W H xinfan(新凡) 说得对,在动态获取图片src的时候就顺便把height和width也动态赋值 只要指定img样式里面的width和height就可以了嘛 <body style="margin:0;overflow:hidden"><img onload="if(this.width>document.body.offsetWidth) this.width=document.body.offsetWidth" src="http://www.phonk.net/Images/Cap-d-Ail/small/010825-Cap-d-Ail.jpg">z注意20px的滚动条 //图片按比例缩放,可输入参数设定初始大小function resizeimg(ImgD,iwidth,iheight) { var image=new Image(); image.src=../../ImgD.src; if(image.width>0 && image.height>0){ if(image.width/image.height>= iwidth/iheight){ if(image.width>iwidth){ ImgD.width=iwidth; ImgD.height=(image.height*iwidth)/image.width; }else{ ImgD.width=image.width; ImgD.height=image.height; } ImgD.alt=image.width+"×"+image.height; } else{ if(image.height>iheight){ ImgD.height=iheight; ImgD.width=(image.width*iheight)/image.height; }else{ ImgD.width=image.width; ImgD.height=image.height; } ImgD.alt=image.width+"×"+image.height; } ImgD.style.cursor= "pointer"; //改变鼠标指针 ImgD.onclick = function() { window.open(this.src);} //点击打开大图片 if (navigator.userAgent.toLowerCase().indexOf("ie") > -1) { //判断浏览器,如果是IE ImgD.title = "请使用鼠标滚轮缩放图片,点击图片可在新窗口打开"; ImgD.onmousewheel = function img_zoom() //滚轮缩放 { var zoom = parseInt(this.style.zoom, 10) || 100; zoom += event.wheelDelta / 12; if (zoom> 0) this.style.zoom = zoom + "%"; return false; } } else { //如果不是IE ImgD.title = "点击图片可在新窗口打开"; } }}具体实现代码如下:<img name="" src=http://www.webjx.com/htmldata/2006-07-30/"" onload="javascript:resizeimg(this,100,200)"> 没分了,也说一下,就像缩略图式的width,height动态获得 DateTime.Now.ToString("yyyy/MM/dd tt hh:mm:ss")插入sql數據庫日期字段出錯? ASP.NET AJAX问题:如何将从Webserver中传送过来的DataTable赋值给客户端Select控件? 自定义用户控件 问题 请教个问题 产生6位数字的随机数? 找不到类型或命名空间名称 怎样用代码实现弹出指定新窗口,并传递参数值啊。。。放分 关于save后的,update问题? 巨难,谁能解决,400分奉上.绝不食言. 表单提交及用户控件中的表单提交等问题 弹出交互窗口出现的问题,请各位帮忙看一下! 为什么没有触发这个事件
Height图片高度
width图片宽度;
应该是
IE设置自动 缩小那么打开IE 设置 高级 启用自动图像大小调整 去掉! 即可如不是 可写死width height
我替楼主说明一下
他的图片应该是不固定的
有时候小于浏览器宽度 如 width:200px 应200px显示
大于浏览器宽度时候 如 2000px 也应按实际宽度显示 2000px如果设置固定宽度的话 就把小于2000px的图片拉伸了 可以动态给IMG的width 和 height赋值
用一个Image对像读到图片的W H,然后设置<img 的 W H
说得对,在动态获取图片src的时候就顺便把height和width也动态赋值
<img onload="if(this.width>document.body.offsetWidth) this.width=document.body.offsetWidth" src="http://www.phonk.net/Images/Cap-d-Ail/small/010825-Cap-d-Ail.jpg">
z注意20px的滚动条
function resizeimg(ImgD,iwidth,iheight) {
var image=new Image();
image.src=../../ImgD.src;
if(image.width>0 && image.height>0){
if(image.width/image.height>= iwidth/iheight){
if(image.width>iwidth){
ImgD.width=iwidth;
ImgD.height=(image.height*iwidth)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>iheight){
ImgD.height=iheight;
ImgD.width=(image.width*iheight)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
ImgD.style.cursor= "pointer"; //改变鼠标指针
ImgD.onclick = function() { window.open(this.src);} //点击打开大图片
if (navigator.userAgent.toLowerCase().indexOf("ie") > -1) { //判断浏览器,如果是IE
ImgD.title = "请使用鼠标滚轮缩放图片,点击图片可在新窗口打开";
ImgD.onmousewheel = function img_zoom() //滚轮缩放
{
var zoom = parseInt(this.style.zoom, 10) || 100;
zoom += event.wheelDelta / 12;
if (zoom> 0) this.style.zoom = zoom + "%";
return false;
}
} else { //如果不是IE
ImgD.title = "点击图片可在新窗口打开";
}
}
}具体实现代码如下:<img name="" src=http://www.webjx.com/htmldata/2006-07-30/"" onload="javascript:resizeimg(this,100,200)">