欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

自己做的模擬模態(tài)對話框?qū)崿F(xiàn)代碼

 更新時間:2012年05月23日 21:54:53   作者:  
最近做完一個項目,發(fā)現(xiàn)瀏覽器兼容問題,模態(tài)對話框只有IE支持,但是IE9又不能支持帶框架的對話框,那個對話框的大小打死都設(shè)置不了,在網(wǎng)上查說因為好多功能被IE9屏蔽了,于是自己做了一個模擬對話框的東西
復(fù)制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標(biāo)題文檔</title>
</head>
<input type="button" value="test" style="height:500px" />
選擇經(jīng)度:<input type="text" id="txtSelect" />
<iframe name="map" src="baidumap.htm" id="map" style="display:none"></iframe>
<body>
</body>
</html>
<script type="text/javascript">
document.getElementById("txtSelect").onfocus=function(){
var windows = document.getElementById("window");
var title = document.getElementById("title");
var layer = document.getElementById("layer");
if(windows==null&&layer==null&&title==null){
var style = document.createElement("style");
style.type="text/css";
document.body.appendChild(style);
var styleText = "#layer{ width:100%;height:100%;background:#000000;position:absolute;z-index:100;left:0;top:0;filter:alpha(opacity=40); opacity:0.4}";
styleText+="#window{position:absolute; z-index:1000;background:#ffc;}";
styleText+="#title{ background:#CCFFFF;width:100%;height:15%;font-size:2em;font-weight:bold; text-align:left; line-height:1.5em }"
styleText+="#content{ height:85%;width:100%;background:#CCCCCC}";
styleText+="#frame{ width:100%;height:100%;} #map{ width:100%;height:100%}";
try{
if(typeof style.styleSheet.cssText!="undefined"){
style.styleSheet.cssText=styleText;
}
}catch(ex){
style.appendChild(document.createTextNode(styleText));
}
var layer = document.createElement("div");
document.body.appendChild(layer);
layer.id="layer";
var windows = document.createElement("div");
document.body.appendChild(windows);
windows.id="window";
windows.style.height="400px";
windows.style.width = "600px";
var height = parseInt(windows.style.height);
var width = parseInt(windows.style.width);
windows.style.top = parseInt(document.documentElement.clientHeight/2-height/2)+"px";
windows.style.left = parseInt(document.documentElement.clientWidth/2-width/2)+"px";
var title = document.createElement("div");
windows.appendChild(title);
title.id="title";
title.appendChild(document.createTextNode("點此關(guān)閉"));
var content = document.createElement("div");
windows.appendChild(content);
content.id="content";
var map = document.getElementById("map");
content.appendChild(map);
map.style.display="block";
if(typeof layer.style.opacity!="undefined"){
layer.style.opacity=0.5;
}
else if(typeof layer.style.filter!="undefined"){
layer.style.filter="alpha(opacity=50)";
}
}
else{
if(typeof layer.style.opacity!="undefined"){
layer.style.opacity=0.5;
}
else if(typeof layer.style.filter!="undefined"){
layer.style.filter="alpha(opacity=50)";
}
layer.style.zIndex=100;
windows.style.zIndex=1000;
layer.style.display="block";
windows.style.display="block";
}
layer.onclick = title.onclick = function(){
windows.style.zIndex=-1000;
windows.style.display="none";
//讓層漸隱
var timer = setTimeout(displayLayer,200);
function displayLayer(){
if(typeof layer.style.opacity!="undefined"){
var layers = document.getElementById("layer");
var opacity = parseFloat(layers.style.opacity);
opacity = opacity-0.1;
if(opacity>0){
setTimeout(arguments.callee,100);
}
else if(opacity<0){
layers.style.zIndex=-100;
clearTimeout(timer);
}
layers.style.opacity = opacity;
}
else if(typeof layer.style.filter!="undefined"){
var layers = document.getElementById("layer");
var filterStyle = layers.style.filter;
//opacity = parseInt(filterStyle.substring(filterStyle.indexOf("=")+1));
var opacity = parseInt(filterStyle.match(/\d+/));
opacity = opacity-10;
if(opacity>0){
setTimeout(arguments.callee,100);
}
else if(opacity<0){
layers.style.zIndex=-100;
clearTimeout(timer);
}
layers.style.filter = "alpha(opacity="+opacity+")";
}
else{
throw new Error("your browser version lower!");
}
}
document.getElementById("txtSelect").value=frames["map"].document.getElementById("hidden").value;
}
}
window.onunload=function(){
var windows = document.getElementById("window");
var title = document.getElementById("title");
var layer = document.getElementById("layer");
layer.onclick = windows.onclick=null; //清除事件綁定
document.body.removeChild(layer);
windows.removeChild(title);
document.body.removeChild(windows);
}
</script>

這是那個框架的頁面,顯示百度地圖的坐標(biāo)
復(fù)制代碼 代碼如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text ml; charset=utf-8">
<title>百度地圖</title>
<script type="text/javascript" src=" http://api.map.baidu.com/api?key=458d39374361da27e548367a735831ba&v=1.0&services=true"></script>
<link href="/Theme/Default/Admin/reset.css" rel="stylesheet" type="text/css" />
<link href="/Theme/Default/Admin/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div>
<form>
<div style="position: absolute; width: 730px; height: 590px; top: 35; left: 0; border: 1px solid gray; overflow-y: hidden;" id="container">
</div>
<input id="text_" class="textbox200" style="width: 150px" type="text" value="成都" />
<input class="button90" type="button" value="查詢" onClick="searchByStationName(document.getElementById('text_').value);" />
<input type="hidden" id="hidden" value="104.105, 30.624" />
</form>
</div>
</body>
<script type="text/javascript">
var map = new BMap.Map("container");
map.centerAndZoom(new BMap.Point(104.105, 30.624), 6);
map.addControl(new BMap.NavigationControl()); //導(dǎo)航
map.addControl(new BMap.ScaleControl());
map.addControl(new BMap.OverviewMapControl());
map.addEventListener("click", function (e) {
document.getElementById("hidden").value = e.point.lng+","+e.point.lat;
});
var localSearch = new BMap.LocalSearch(map, {
renderOptions: {
pageCapacity: 8,
autoViewport: true,
selectFirstResult: false
}
});
localSearch.enableAutoViewport();
function searchByStationName(name) {
var keyword = name;
localSearch.setSearchCompleteCallback(function (searchResult) {
var poi = searchResult.getPoi(0);
alert(poi.point.lng + " " + poi.point.lat);
document.getElementById("hidden").value = e.point.lng+","+e.point.lat;
map.centerAndZoom(poi.point, 8);
});
localSearch.search(keyword);
}
</script>
</html>

相關(guān)文章

  • select多選 multiple的使用示例

    select多選 multiple的使用示例

    使用multiple可以實現(xiàn)select多選,本例將為大家介紹下select多選 multiple的使用,新手朋友們可以學(xué)習(xí)下
    2014-06-06
  • JS實現(xiàn)獲取word文檔內(nèi)容并輸出顯示到html頁面示例

    JS實現(xiàn)獲取word文檔內(nèi)容并輸出顯示到html頁面示例

    這篇文章主要介紹了JS實現(xiàn)獲取word文檔內(nèi)容并輸出顯示到html頁面,結(jié)合實例形式分析了JavaScript使用ActiveXObject組建操作word文件的相關(guān)實現(xiàn)技巧,需要的朋友可以參考下
    2018-06-06
  • JS 箭頭函數(shù)的this指向詳解

    JS 箭頭函數(shù)的this指向詳解

    這篇文章主要給大家介紹了關(guān)JS 箭頭函數(shù)的this指向,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-11-11
  • JavaScript中的property和attribute介紹

    JavaScript中的property和attribute介紹

    JavaScript中的property和attribute介紹,需要的朋友可以參考下。
    2011-12-12
  • promise處理多個相互依賴的異步請求(實例講解)

    promise處理多個相互依賴的異步請求(實例講解)

    下面小編就為大家?guī)硪黄猵romise處理多個相互依賴的異步請求(實例講解)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-08-08
  • JavaScript中實現(xiàn)最高效的數(shù)組亂序方法

    JavaScript中實現(xiàn)最高效的數(shù)組亂序方法

    這篇文章主要介紹了JavaScript中實現(xiàn)最高效的數(shù)組亂序方法,數(shù)組亂序的意思是,把數(shù)組內(nèi)的所有元素排列順序打亂,需要的朋友可以參考下
    2014-10-10
  • 微信小程序?qū)崿F(xiàn)留言板

    微信小程序?qū)崿F(xiàn)留言板

    這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)留言板,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-10-10
  • 詳解JavaScript的定時器

    詳解JavaScript的定時器

    這篇文章主要為大家介紹了JavaScript的定時器 ,具有一定的參考價值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助
    2021-11-11
  • js檢測判斷日期大于多少天的方法

    js檢測判斷日期大于多少天的方法

    這篇文章主要介紹了js檢測判斷日期大于多少天的方法,涉及javascript操作日期的相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2015-05-05
  • 深入理解Ajax的get和post請求

    深入理解Ajax的get和post請求

    下面小編就為大家?guī)硪黄钊肜斫釧jax的get和post請求。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-06-06

最新評論