永发信息网

谁能帮我看看这个代码错在哪里啊?怎么就是调试不成功哦!

答案:1  悬赏:50  手机版
解决时间 2021-04-27 21:57
  • 提问者网友:蔚蓝的太阳
  • 2021-04-27 05:04

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=javascript>
function imgMax(Imgid ,width,height)
{
//var width=200;
//var height=200;
img =new Img();
img.src=Imgid.src;
if ( img.width > width || img.height > height )
{
if ( img.width > img.height)
{
img.height = img.height*(width/img.width);
img.width = width;
}
else
{
img.width = img.width*(height/n.height);
img.height = height;
}
}
if (img.height < height )
{
img.style.paddingTop = ( height -img.height ) /2 + "px";
}
}

</script>
<title>图片的缩放</title>
</head>

<body>
<img onload ="imgMax(this ,200 ,200) src="D:\照片\亲戚2.jpg" id="pic">

</body>

</html>

最佳答案
  • 五星知识达人网友:上分大魔王
  • 2021-04-27 05:59

报的什么错啊,你把java脚本放在</html>外面试试

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯