最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

js實(shí)現(xiàn)仿qq消息的彈出窗效果

 更新時間:2016年01月06日 09:54:39   作者:偽磚家  
這篇文章主要介紹了js實(shí)現(xiàn)仿qq消息的彈出窗效果,文章代碼實(shí)現(xiàn)模擬qq彈出框消息提醒,感興趣的小伙伴們可以參考一下

在我們的日常開發(fā)中,或者生活中,經(jīng)常需要用到彈出窗。這里我們就用js模擬一下qq消息一樣的彈出窗,分享給大家供大家參考,具體內(nèi)容如下
運(yùn)行效果截圖:

直接貼代碼:

<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gbk" /> 
<title>javaScript實(shí)現(xiàn)網(wǎng)頁右下角彈出窗口代碼</title> 
</head> 
<body> 
<script type="text/javascript"> 
var ShowMsg={ 
  title:'提示', 
  content:'模擬qq彈出框消息提醒', 
  width:'300px', 
  height:'100px', 
  setTitle:function(value){ 
    this.title=value; 
  }, 
  setContent:function(value){ 
    this.content=value; 
  }, 
  getTitle:function(){ 
    return this.title; 
  }, 
  getContent:function(){ 
    return this.content; 
  }, 
  show:function(){ 
    //彈窗div 
    var _winPopDiv = document.createElement('div');  
      _winPopDiv.id="_winPopDiv";  
      _winPopDiv.style.cssText = 'width:300px; position:absolute; right:0; bottom:0; border:1px solid #666; margin:0; padding:1px; overflow:hidden; display:block;'; 
    //消息標(biāo)題div 
    var _titleDiv= document.createElement('div');  
      _titleDiv.id="_titleDiv";   
      _titleDiv.innerHTML=this.getTitle();  
      _titleDiv.style.cssText = 'width:100%; height:22px; line-height:20px; background:#FFCC00; font-weight:bold; text-align:left; font-size:14px;';  
      _winPopDiv.appendChild(_titleDiv); 
    //關(guān)閉消息按鈕span 
    var _closeSpan= document.createElement('span');  
      _closeSpan.id="_closeSpan";  
      _closeSpan.innerHTML="X"; 
      _closeSpan.style.cssText = 'position:absolute; right:4px; top:-1px; color:#FFF; cursor:pointer;font-size:14px;';  
      _titleDiv.appendChild(_closeSpan);  
    //內(nèi)容div 
    var _conDiv= document.createElement('div');  
      _conDiv.id="_conDiv";  
      _conDiv.style.cssText = 'width:100%; height:110px; line-height:80px; font-weight:bold; font-size:12px; color:#FF0000; text-decoration:underline; text-align:center;';  
      _conDiv.innerHTML=this.getContent(); 
      _winPopDiv.appendChild(_conDiv);   
    document.body.appendChild(_winPopDiv);  
    //關(guān)閉span綁定事件 
    var closeDiv = document.getElementById("_closeSpan"); 
    if(closeDiv.addEventListener){ 
      closeDiv.addEventListener("click",function(e){  
        if (window.event != undefined) {  
          window.event.cancelBubble = true;  
        } else if (e.stopPropagation) {  
          e.stopPropagation();  
        }  
        document.getElementById('_winPopDiv').style.cssText="display:none;"; 
      },false); 
    }else if(closeDiv.attachEvent){ 
      closeDiv.attachEvent("onclick",function(e){  
        if (window.event != undefined) {  
          window.event.cancelBubble = true;  
        } else if (e.stopPropagation) {  
          e.stopPropagation();  
        }  
        document.getElementById('_winPopDiv').style.cssText="display:none;"; 
      }); 
    } 
  } 
}; 
ShowMsg.show(); 
</script> 
</body> 
</html>

 希望本文所述對大家學(xué)習(xí)javascript程序設(shè)計有所幫助。

相關(guān)文章

最新評論

巫山县| 唐海县| 长武县| 吉林市| 阳泉市| 武强县| 宜兰县| 田阳县| 库伦旗| 华宁县| 诏安县| 延川县| 微山县| 南充市| 呼和浩特市| 蒲江县| 枣强县| 托克逊县| 本溪| 盘山县| 沅陵县| 武定县| 平利县| 土默特左旗| 桂东县| 砀山县| 杭锦后旗| 棋牌| 寿宁县| 东丰县| 成都市| 伊春市| 昌黎县| 湘潭县| 调兵山市| 宁明县| 临朐县| 金昌市| 卢氏县| 建水县| 灯塔市|