1.这种写法:(function(){})(),同时注意:原生的异步对象的兼容性实例化方法

<script>
document.domain = "qq.com";
xmlHttp = (function() {
    var f;
    if(window.ActiveXObject) {
        f = function() { return new ActiveXObject('Microsoft.XMLHTTP');};
    } else if(window.XMLHttpRequest) {
        f = function() { return new XMLHttpRequest();};
    } else {
        f = function() { return;};
    }
    return f;
})();
说明:定义一个函数,然后执行调用这个函数
查看地址:(chrome浏览器)
view-source:http://radio.t.qq.com/proxy.html

拓展参考文章:https://www.cnblogs.com/wisdo/p/5074419.html

 2.页面尺寸大小变化,都修正iframe的高度。 


JS:
$(document).ready(function () { function fixHeight() { var headerHeight = $("#switcher").height(); $("#iframe").attr("height", $(window).height()-54+ "px"); } $(window).resize(function () { fixHeight(); }).resize(); });
HTML:

<div id="switcher">
<div class="center">
<ul>
<div id="Device">
<li class="device-monitor"><a href="javascript:">
<div class="icon-monitor">
</div>
</a></li>
<li class="device-mobile"><a href="javascript:">
<div class="icon-tablet">
</div>
</a></li>
<li class="device-mobile"><a href="javascript:">
<div class="icon-mobile-1">
</div>
</a></li>
<li class="device-mobile-2"><a href="javascript:">
<div class="icon-mobile-2">
</div>
</a></li>
<li class="device-mobile-3"><a href="javascript:">
<div class="icon-mobile-3">
</div>
</a></li>
</div>

<li class="remove_frame"><a href="http://www.jq22.com/demo/jQuery-huandong20161108" title="移除框架">
</a></li>

</ul>
</div>
</div>
<div id="iframe-wrap">
<iframe id="iframe" src="http://www.jq22.com/demo/jQuery-huandong20161108" frameborder="0" width="100%">
</iframe>
</div>
</div>

 

 

3. ... ...

posted on 2017-11-17 09:14  踏歌&而行  阅读(207)  评论(0编辑  收藏  举报