dreamweaver网页的JS里怎么设置让图片自动缩小至规定的尺寸?
<divid="imgADPlayer"style="display:block;width:320px;height:240px;position:relative;o...
<div id="imgADPlayer" style="display: block; width: 320px; height: 240px; position: relative; overflow: hidden;"><a href="http://www.anyilvhejin.com/ch/index.asp#" title="1" target="_blank" style="display: block; text-decoration: none; width: 320px; height: 240px; background-image: url(http://www.anyilvhejin.com/ch/img/3.jpg); background-position: 50% 50%; background-repeat: no-repeat no-repeat; "></a>
<ul style="margin:0; width:320px; position:absolute; right:-1px; FILTER:Alpha(Opacity=30,FinishOpacity=90, Style=1); overflow: hidden; bottom:-1px; height:16px; border-right:0px solid #002342; z-index: 999; background-image: url(img/3.jpg); layer-background-image: url(img/3.jpg); border: 1px none #000000;">
<li style="margin:0;list-style-type: none; margin:0;padding:0; float:right;"><span onmouseover="PImgPlayer.mouseOver(this);" onmouseout="PImgPlayer.mouseOut(this);" style="clear:both; display:block; width:23px;line-height:18px; font-size:12px; FONT-FAMILY:'宋体'; opacity: 0.6;border:1px solid #002342;border-right:0;border-bottom:0;color:#ffffff;text-align:center; cursor:pointer; background:#ff0000;" onclick="PImgPlayer.play(4);return false;" herf="javascript:;" title="1">5</span></li>
</ul>
</div> 展开
<ul style="margin:0; width:320px; position:absolute; right:-1px; FILTER:Alpha(Opacity=30,FinishOpacity=90, Style=1); overflow: hidden; bottom:-1px; height:16px; border-right:0px solid #002342; z-index: 999; background-image: url(img/3.jpg); layer-background-image: url(img/3.jpg); border: 1px none #000000;">
<li style="margin:0;list-style-type: none; margin:0;padding:0; float:right;"><span onmouseover="PImgPlayer.mouseOver(this);" onmouseout="PImgPlayer.mouseOut(this);" style="clear:both; display:block; width:23px;line-height:18px; font-size:12px; FONT-FAMILY:'宋体'; opacity: 0.6;border:1px solid #002342;border-right:0;border-bottom:0;color:#ffffff;text-align:center; cursor:pointer; background:#ff0000;" onclick="PImgPlayer.play(4);return false;" herf="javascript:;" title="1">5</span></li>
</ul>
</div> 展开
1个回答
展开全部
你这是上传服务器之后又复制下来的吧?
<script language="JavaScript">
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>= 200/200){
if(image.width>200){
ImgD.width=200;
ImgD.height=(image.height*200)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
else{
if(image.height>200){
ImgD.height=200;
ImgD.width=(image.width*200)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
}
</script>
上面这段写在 head里
下面的代码写到body里:
<img src=# onload=javascript:DrawImage(this); >
<script language="JavaScript">
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>= 200/200){
if(image.width>200){
ImgD.width=200;
ImgD.height=(image.height*200)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
else{
if(image.height>200){
ImgD.height=200;
ImgD.width=(image.width*200)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
}
</script>
上面这段写在 head里
下面的代码写到body里:
<img src=# onload=javascript:DrawImage(this); >
博思aippt
2024-07-20 广告
2024-07-20 广告
作为深圳市博思云创科技有限公司的工作人员,对于Word文档生成PPT的操作,我们有以下建议:1. 使用另存为功能:在Word中编辑完文档后,点击文件->另存为,选择PowerPoint演示文稿(*.pptx)格式,即可将文档内容转换为PPT...
点击进入详情页
本回答由博思aippt提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询