我正在尝试制作一个剪辑窗口,但没有发生,这是代码示例:
<html>
<head>
<style>
#clippingWindow
{
height:178px;
width:278px;
overflow: hidden;
}
#bgImg
{
left:35px;
border:54px;
}
</style>
<script language="javascript">
function getImgSize()
{
var ds = document.getElementsByName('a');
var wid = ds[0].width;
var pos = (wid-278)/2;
alert(pos);
alert(ds[0].id);
if(ds[0].width>278)
{
dt.style.left=500; //this is not working
}
}
</script>
</head>
<body><input type="button" onClick="getImgSize();">
<div id="clippingWindow">
<img name="a" src="sss.bmp" id="bgImg">
</div><br><br><br>
<div id="ad">
<img name="a" src="484.jpeg">
</div>
</body>
</html>