<img src="" id=x>document.all.x.width
document.all.x.height
document.all.x.height
解决方案 »
- 网页导航栏点击背景色更换
- 我想做选择地址的两个select 分别是省和城市 但是运行不了 请问有什么问题啊??
- asp.net常用的javascript经典例子
- js怎么比较两个百分数的大小
- DIV和BODY的滚过条问题
- Embed获取音乐当前播放时间
- 高手请进!如果我用javascript随机生成10张图片单总是有重复的,请问有方法避免吗?(除了多加图片)
- 如何屏蔽一个页面上的多个按钮??
- JavaScript有没有判定输入内容是否是数值的函数?
- 怎样删除一个select里的所有options
- 怎么让弹出窗口自动调节高度?
- 如何在asp页面中 浮动出一个框来,询问是否要将本站加为首页。类似于sina前段时间的显示
<script>
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 164/112){
if(image.width>164){
ImgD.width=164;
ImgD.height=(image.height*164)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>112){
ImgD.height=112;
ImgD.width=(image.width*112)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
}
}
//-->
</script>
<a href="<%=trim(rs("picurl"))%>" target="_blank">
<img src="<%=trim(rs("imgurl"))%>" border="0" width="164" height="112" onload="javascript:DrawImage(this);">
</a>
------------------------------
自动改变图片大小
<script>
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 164/112){
if(image.width>164){
ImgD.width=164;
ImgD.height=(image.height*164)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>112){
ImgD.height=112;
ImgD.width=(image.width*112)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
}
}
//-->
</script>
<a href="<%=trim(rs("picurl"))%>" target="_blank">
<img src="<%=trim(rs("imgurl"))%>" border="0" width="164" height="112" onload="javascript:DrawImage(this);">
</a>
高<input type="text" name="h">
宽<input type="text" name="w">
<div style="position:absolute;top:;left:0;visibility:hidden">
<img id="img" onload="Show(this)">
</div>
<script language="JavaScript">
function Show(oImg)
{
document.all.h.value=oImg.height;
document.all.w.value=oImg.width;
}
</script>