<script type="text/javascript"> window.onload=function(){ map_width=document.body.clientWidth;//獲取body寬度 map_height=document.documentElement.clientHeight;//獲取頁面可見高度 //alert(map_width); //alert(map_height); //下面兩行最后的"px"必須加上,折騰了半天老是不顯示添加的style,最后就是錯在這了 document.getElementByIdx_x_x("maps").style.width=map_width+"px"; document.getElementByIdx_x_x("maps").style.height=map_height+"px"; } </script>
function iframeHeight(iframeId,change) { var ifm= document.getElementById(iframeId); ifm.name=iframeId; var clientHeight=document.documentElement.clientHeight; clientHeight=clientHeight-change; var subWeb = document.frames ? document.frames[iframeId].document : ifm.contentDocument; if(ifm != null && subWeb != null) { var scrollHeight=subWeb.body.scrollHeight; if(scrollHeight>clientHeight){ ifm.height = clientHeight; }else{ ifm.height = scrollHeight; } } }