<body id=body1 onresize="location.reload()"> <!-- 下面以一个图片为例子,其他控件类似,假设图象在800宽的页面上宽和高为480和754,具有缩放功能的例子如下 --> <script> var imgratio=480/754; var ratio=800/480 var newwidth=body1.clientWidth var newimg=Math.round(newwidth/ratio) var newimgheight=Math.round(newimg/imgratio) document.write("<img src='http://lucky.myrice.com/back.jpg' width="+newimg+" height="+newimgheight+">") </script>
[email protected]
<!-- 下面以一个图片为例子,其他控件类似,假设图象在800宽的页面上宽和高为480和754,具有缩放功能的例子如下 -->
<script>
var imgratio=480/754;
var ratio=800/480
var newwidth=body1.clientWidth
var newimg=Math.round(newwidth/ratio)
var newimgheight=Math.round(newimg/imgratio)
document.write("<img src='http://lucky.myrice.com/back.jpg' width="+newimg+" height="+newimgheight+">")
</script>