<table width="500px" height="300px" id="TableID">
<tr><td><img src="#" id="ImgID"></td></tr>
</table>
<object id="fileDialog" width="0px" height="0px" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" codebase="http://activex.microsoft.com/controls/vb5/comdlg32.cab">
</object>
<br>
<input type=button value=加载图片 onclick="loadImage()">
<script>
function loadImage()
{
fileDialog.CancelError=true;
try{
fileDialog.Filter="JPG文件 (*.jpg)|*.jpg|GIF文件 (*.gif)|*.gif";
fileDialog.ShowOpen();
ImgID.src="file:///"+fileDialog.filename;
ImgID.height=TableID.height;
ImgID.width=TableID.width;
}catch(e){}
}
</script>
<tr><td><img src="#" id="ImgID"></td></tr>
</table>
<object id="fileDialog" width="0px" height="0px" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" codebase="http://activex.microsoft.com/controls/vb5/comdlg32.cab">
</object>
<br>
<input type=button value=加载图片 onclick="loadImage()">
<script>
function loadImage()
{
fileDialog.CancelError=true;
try{
fileDialog.Filter="JPG文件 (*.jpg)|*.jpg|GIF文件 (*.gif)|*.gif";
fileDialog.ShowOpen();
ImgID.src="file:///"+fileDialog.filename;
ImgID.height=TableID.height;
ImgID.width=TableID.width;
}catch(e){}
}
</script>
<tr><td><img src="#" id="ImgID" style="width:expression(TableID.width);height:expression(TableID.height)"></td></tr>
</table>
http://www.51windows.net/hw/myimg/index.asp?ps=5&od=&Page=2
我的意思是说:这个table的大小不会变化,图片的长跟宽按相同的比例缩小到table固定的宽,长有变化。或者是固定的长,宽有变化,但长跟宽不会超出这个table固定的长跟宽。
table的长或者宽应该是有一个有变化,我可能说错了.
当然我非常想知道http://www.51windows.net/hw/myimg/index.asp?ps=5&od=&Page=2这样的效果是什么弄出来的
分数我会马上给,只要有人给出答案,多谢多谢
你只要设置图片的宽就可以了.
<img src="http://www.51windows.net/hw/myimg/pic/2003914014322874.jpg" border="0" width="360">
<table border="0" cellpadding="0" cellspacing="1" width="600" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#043264" width="600" align="center" colspan="2"><font color="#FFFFFF">图片收藏</font></td>
</tr>
<tr bgcolor="#EEEEEE">
<td width="600" align="center">
<p align="center"><img src="http://www.51windows.net/hw/myimg/pic/2003914014322874.jpg" border="0" width="360" onclick=open("img.htm?phttp://www.51windows.net/hw/myimg/pic/2003914014322874.jpg","","top=5,left=5,width=100,height=100") hspace="10" vspace="10" style="cursor:hand" title="点击看大图"><br><b style="color:red">又是草莓成熟时</b></td>
</tr>
<tr bgcolor="#EEEEEE">
<td width="600" align="center">
<p align="center"><img src="http://www.51windows.net/hw/myimg/pic/2003914012924161.jpg" border="0" width="360" onclick=open("img.htm?http://www.51windows.net/hw/myimg/pic/2003914012924161.jpg","","top=5,left=5,width=100,height=100") hspace="10" vspace="10" style="cursor:hand" title="点击看大图"><br><b style="color:red">阳光下的小草</b></td>
</tr>
</table>