发布于 2016-12-26 22:56:47 | 122 次阅读 | 评论: 0 | 来源: 网友投递
这里有新鲜出炉的Javascript教程,程序狗速度看过来!
JavaScript客户端脚本语言
Javascript 是一种由Netscape的LiveScript发展而来的原型化继承的基于对象的动态类型的区分大小写的客户端脚本语言,主要目的是为了解决服务器端语言,比如Perl,遗留的速度问题,为客户提供更流畅的浏览效果。
var iframeids = ['memberIndexIframe','inquiryCenterIframe','everychinaBbsIframe'];
var iframehide = "yes";
function dynIframeSize(){
var dyniframe = [];
for(var i=0;i<iframeids.length;i++){
if(!document.getElementById) return false;
dyniframe[i] = document.getElementById(iframeids[i]);
if(dyniframe[i] && !window.opera){
dyniframe[i].style.display = "block";
if(dyniframe[i].contentDocument && dyniframe[i].contentDocument.body.offsetHeight){
dyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight;
}else if(dyniframe[i].Document && dyniframe[i].Document.body.scrollHeight){
dyniframe[i].height = dyniframe[i].Document.body.scrollHeight;
}
}
if((document.all || document.getElement) && iframeids == "no") {
var tempobj = document.all?document.all[iframeids[i]] : document.getElementById(iframeids[i]);
tempobj.style.display = "block";
}
}
}
if (window.addEventListener)
window.addEventListener("load", dynIframeSize, false)
else if (window.attachEvent)
window.attachEvent("onload", dynIframeSize)
else {
window.onload = dynIframeSize;
}
<BODY>
<iframe width="100%" id="a_iframe" name="a_iframe" src="http://对方域名/b.html"
frameborder="no" border="0px" scrolling="no" allowtransparency="yes" ></iframe>
</BODY>
<script type="text/javascript">
//得到a.html中的a_iframe
var a_iframe = parent.parent.document.getElementById("a_iframe");
//<SPAN>location.hash用来获取页面的标签值</SPAN>
,这个值通过b.html中的js函数改变。包括height属性
var hash_url = window.location.hash;
//得到b.html传递过来的height属性
var hash_height = hash_url.split("#")[1]+"px";
//调整a_iframe的height,达到自适应
a_iframe.height = hash_height;
</script>
<iframe id="b_iframe" width="100%" src="http://我的域名/../agent.html" style="display:none">
</iframe>
<script type="text/javascript">
var b_height = Math.max(document.body.scrollHeight,document.body.clientHeight);
var b_iframe = document.getElementById("b_iframe");
b_iframe.src = b_frame.src+"#"+b_height;
</script>
<script>
var strInfo=" " ;
strInfo+=" \r\n网页可见区域宽:" +document.body.clientWidth;
strInfo+=" \r\n网页可见区域高:" +document.body.clientHeight;
strInfo+=" \r\n网页可见区域宽:" +document.body.offsetWidth+" (包括边线的宽)" ;
strInfo+=" \r\n网页可见区域高:" +document.body.offsetHeight+" (包括边线的宽)" ;
strInfo+=" \r\n网页正文全文宽:" +document.body.scrollWidth;
strInfo+=" \r\n网页正文全文高:" +document.body.scrollHeight;
strInfo+=" \r\n网页被卷去的高:" +document.body.scrollTop;
strInfo+=" \r\n网页被卷去的左:" +document.body.scrollLeft;
strInfo+=" \r\n网页正文部分上:" +window.screenTop;
strInfo+=" \r\n网页正文部分左:" +window.screenLeft;
strInfo+=" \r\n屏幕分辨率的高:" +window.screen.height;
strInfo+=" \r\n屏幕分辨率的宽:" +window.screen.width;
strInfo+=" \r\n屏幕可用工作区高度:" +window.screen.availHeight;
strInfo+=" \r\n屏幕可用工作区宽度:" +window.screen.availWidth;
window.confirm(strInfo);
</script>