讓IE8瀏覽器支援function.bind()方法,ie8function.bind

來源:互聯網
上載者:User

讓IE8瀏覽器支援function.bind()方法,ie8function.bind

IE8支援function.bind()方法

<script type="text/javascript"> if (!Function.prototype.bind) { Function.prototype.bind = function (oThis) { if (typeof this !== "function") { throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function () {}, fBound = function () { return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } </script>

主要解決“百度地圖”官網上的例子的bug,摘取如下代碼:

<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> body, html {width: 100%;height: 100%;margin:0;font-family:"微軟雅黑";} #allmap{width:100%;height:500px;} p{margin-left:5px; font-size:14px;} </style> <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=39b92e64ae5622663ceceaccd8ab8eb1"></script> <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script> <title>給多個點添加資訊視窗</title> <script type="text/javascript"> if (!Function.prototype.bind) { Function.prototype.bind = function (oThis) { if (typeof this !== "function") { throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function () {}, fBound = function () { return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } </script> </head> <body> <div id="allmap"></div> <p>點擊標註點,可查看由純文字構成的簡單型資訊視窗</p> </body> </html> <script type="text/javascript"> // 百度地圖API功能 map = new BMap.Map("allmap"); map.centerAndZoom(new BMap.Point(116.417854,39.921988), 15); var data_info = [[116.417854,39.921988,"地址:北京市東城區王府井大街88號樂天銀泰百貨八層"], [116.406605,39.921585,"地址:北京市東城區東華門大街"], [116.412222,39.912345,"地址:北京市東城區正義路甲5號"] ]; var opts = { width : 250, // 資訊視窗寬度 height: 80, // 資訊視窗高度 title : "資訊視窗" , // 資訊視窗標題 enableMessage:true//設定允許資訊窗發送短息 }; for(var i=0;i<data_info.length;i++){ var marker = new BMap.Marker(new BMap.Point(data_info[i][0],data_info[i][1])); // 建立標註 var content = data_info[i][2]; map.addOverlay(marker); // 將標註添加到地圖中 marker.addEventListener("click",openInfo.bind(null,content)); } function openInfo(content,e){ var p = e.target; var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat); var infoWindow = new BMap.InfoWindow(content,opts); // 建立資訊視窗對象 map.openInfoWindow(infoWindow,point); //開啟資訊視窗 } </script>

怎設定讓IE8瀏覽器每次開啟的頁面都是全屏?

你可以嘗試一下對瀏覽器進行重設,看看會不會有效果。可以到→工具”-→Internet選項”-→進階”選項卡,找到→重設”選項,把瀏覽器重設一遍,不行就重新安裝一次瀏覽器。如果以上辦法均無法解決你的問題,那可以嘗試通過Windows還原功能,還原到以前沒有出問題的時間點。另外,建議你做如下的操作
在Windows xp下可以到控制台中的添加刪除程式中的Windows組件中進行卸載,如果是Windows vista可以在控制台的程式和功能中選擇已安裝的更新,然後找到IE8進行卸載。之後再重新載入!
 
怎才可以讓IE8瀏覽器選擇一個視窗開啟多個網頁?

在ie8中 開啟internet選項 快顯視窗中第一卡片夾的下方倒數第二行有個 選項卡設定 點設定進去後
“在遇到快顯視窗時” 勾選第三個“始終在新選項卡中開啟快顯視窗”
確認退出後就可以了
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.