Pure JS to achieve imitation QQ mailbox Pop-up confirmation box

Source: Internet
Author: User
Tags visibility

Imitation QQ mailbox pop-up layer, pop-up confirmation box, mainly with Firefox firebug HTML and CSS buckle down, did not do encapsulation, defined a drag event. You can encapsulate your own pop-up window, hehe!

The code is very simple, there is no more nonsense.

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30-31 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 The 96 97 98 99 100 101 102 103 104 105 106 107 108 109 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140-1 41 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170-171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201-2 02 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231-232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262-2 63 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298-299 302 303 304 <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <HTML> <HEAD> <title>qq mailbox pop-up layer </TITLE> <meta http-equiv=" Content-type "content=" text /html; Charset=utf-8 "/> <style> body {background:none Repeat scroll 0 0 #FFFFFF; font-family:" Lucida Grande ", Verdana ; font-size:12px; Select, body, textarea {font-size:12px}. tipbg {margin:0; padding:0; background-color:transparent;} qmpanel_sh Adow {border-radius:3px 3px 3px 3px box-shadow:0 2px 7px rgba (0, 0, 0, 0.35); bd_upload {border:1px solid #628D0B ; }. bd_upload {border:1px solid #628D0B; fdbody {border-left:8px solid #FFFFFF; border-right:1px solid #87A34D;}. Fdbody,. tipstitle {background:none Repeat scroll 0 0 #9BBB59; editor_dialog_title {color:white; Font:bold 12px "L Ucida Grande ", Verdana; padding:9px 0 7px 10px; Text-align:left; }. editor_dialog_content {Background:none Repeat scroll 0 0 #FFFFFF; Filter:none; margin:0; padding:0; Text-align:center; }. mailinfo {border-bottom:2px solid #FFFFFF; mailinfo {background:none repeat scroll 0 0 #FFFFFF;}. cnfx_content {padding:10px 0 5px 10px; text-align:left;} . cnfx_status {float:left padding:0 0 0 10px; cnfx_btn {padding:0 10px 10px 0; text-align:right;}. b_size {font -size:14px; }. editor_close {background:none Repeat scroll 0 0 #DC4835;}/** when Mouseover,add editor_close_mover*/. Editor_close, . editor_close_mover {border:1px solid #A7190F; cursor:pointer float:right; margin:7px 7px 0 0; editor_close img, . editor_close_mover img,. editor_min img,. editor_min_mover img {display:block; \ img {border:medium none; wd2 {m argin:1px 1px 0 0; width:64px; }. btn, button,. qm_btn {padding-left:0; padding-right:0;} input, TextArea, a {outline:medium none; Editor_mask { Background:none Repeat scroll 0 0 #FFFFFF; height:100%; left:0; opacity:0.5; Position:absolute; Top:0; width:100%; </style> <script>/////////Drag tool class////////var dragutil = (function () {var doc = document;   VAR MoveX = 0; var movey = 0; var movetop = 0; var moveLeft = 0; var moveable = false; return {/** * Register drag * You need to pass the ID of the entire form ID and the title part/regist:function (Winid,titleid) {//page head to add://<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">//Otherwise there will be a problem var width = doc.documentElement.clientWidth; var height = doc.documentElement.clientHeight; var title = Doc.getelementbyid (TitleID); var win = Doc.getelementbyid (Winid); Title.onmousedown = function () {var evt = dragutil._getevent ();   moveable = true; MoveX = evt.clientx; Movey = evt. ClientY;   Movetop = parseint (win.style.top); MoveLeft = parseint (win.style.left);   Doc.onmousemove = function () {if (moveable) {var evt = dragutil._getevent (); var x = MoveLeft + Evt.clientx-mov EX;   var y = movetop + Evt.clienty-movey; var w = parseint (win.style.width); var h = parseint (win.style.height);     if (x > 0 && (x + W < width) && y > 0 && (y + H < height)) {Win.style . left = x + "px"; Win.style.top = y + "px"; } } }; Doc.onmouseup = function () {if (moveable) {//doc.onmousemove = docmousemoveevent;//doc.onmouseup = docmouseupevent; mo Veable = false; MoveX = 0; Movey = 0; movetop = 0; MoveLeft = 0; } }; }/** * Get event * *, _getevent:function () {return window.event | | arguments.callee.caller.arguments[0];} } ()///////////////////////function init () {dragutil.regist ("Windowid", "TitleID") dragutil.regist ("WindowId2", " TitleId2 ")} </script> </HEAD> <body onload=" init () "> <span id=" Qmdialog_container "><div Style= "Z-INDEX:1120; Position:absolute; width:447px; height:163px; Opacity:1; left:514px; top:124px; Margin-top:0pt "class=" "id=" Windowid "qmanimation_play=" |undefined "> <div class=" TIPBG "> <div style=" BacKground: #DDD; "class=" Opashowouter Qmpanel_shadow "id=" Qmconfirm___opashow_ "> <table cellspacing=" 0 " cellpadding= "0" style= "WIDTH:447PX; Height:163px;background:white, "class=" Bd_upload "> <tbody> <tr> <td style=" HEIGHT:28PX; Border:none; Background-image:none; Cursor:move; Overflow:hidden "class=" Editor_dialog_titlebar fdbody "id=" Qmconfirm___title_td_ "><div id=" QMconfirm___ Title_div_ "style=" Cursor:default; Float:right; width:40px; Border:none; Background-image:none; "class=" Fdbody "> <div onmouseout=" this.classname= ' editor_close '; "onmouseover=" This.classname= ' Editor_close_mover '; "class=" Editor_close "id=" qmconfirm___closebtn2_ "> <img height=" 12 " Width= "ondragstart=" return false; "src=" Http://www.3lian.net/jscss/demoimg/201109/ico_closetip.gif "> </ div> </div> <div id= "TitleID" class= "editor_dialog_title" > Delete confirmation </div> </td> </tr> <tr> <td valign= "Top" style= "HEIGHT:131PX; Border: Medium None; Visibility:visible "class=" editor_dialog_content "id=" Qmconfirm___content_ "><div class=" Mailinfo "style=" Border:none; height:100%; Display:inline; " > <div class= "> <div class=" cnfx_content "> <img align=" absmiddle "style=" float:left; margin:5px 10px 0; Display:block, "src=" Http://www.3lian.net/jscss/demoimg/201109/ico_question.gif "> <table style=" width:350px ; height:80px; " > <tbody> <tr> <td style= "vertical-align:top;" ><div class= "b_size" style= "padding-top:10px; Word-break:break-all; line-height:150%; " > <div> The message will not be restored after the total deletion, are you sure you want to delete it? </div> </div></td></tr></tbody> </table> </div> <div style= "Display: none; "class=" Cnfx_status "> <input type=" checkbox "id=" Qmconfirm__recordstatus "><label for=" qmconfirm__ RecordStatus "></label> </div> <div class=" cnfx_btn "> <input type=" button "value=" OK "id=" Qmconfirm__confirm "class=" wd2BTN "><input type=" button "value=" cancels "style=" Display: id= "Qmconfirm__cancel" class= "wd2 btn" ><input type = "button" value= "" style= "Display:none" id= "Qmconfirm__never" class= "Wd2 btn" > </div> </div> </div& Gt </td> </tr> </tbody> </table> </div> </div> </div> </span> <span id= "Qmdialog_container" ><div style= "z-index:1120; Position:absolute; width:447px; height:163px; Opacity:1; left:514px; top:324px; Margin-top:0pt "class=" "id=" WindowId2 "qmanimation_play=" |undefined "> <div class=" TIPBG "> <div style=" Background: #DDD; "class=" Opashowouter Qmpanel_shadow "id=" Qmconfirm___opashow_ "> <table cellspacing=" 0 " cellpadding= "0" style= "WIDTH:447PX; Height:163px;background:white, "class=" Bd_upload "> <tbody> <tr> <td style=" HEIGHT:28PX; Border:none; Background-image:none; Cursor:move; Overflow:hidden "class=" Editor_dialog_titlebar fdbody "id=" qmconfirm___tItle_td_ "><div id=" qmconfirm___title_div_ "style=" Cursor:default; Float:right; width:40px; Border:none; Background-image:none; "class=" Fdbody "> <div onmouseout=" this.classname= ' editor_close '; "onmouseover=" This.classname= ' Editor_close_mover '; "class=" Editor_close "id=" qmconfirm___closebtn2_ "> <img height=" 12 " Width= "ondragstart=" return false; "src=" Http://www.3lian.net/jscss/demoimg/201109/ico_closetip.gif "> </ div> </div> <div id= "titleId2" class= "editor_dialog_title" > Delete confirmation </div> </td> </tr> <tr> <td valign= "Top" style= "HEIGHT:131PX; Border:medium none; Visibility:visible "class=" editor_dialog_content "id=" Qmconfirm___content_ "><div class=" Mailinfo "style=" Border:none; height:100%; Display:inline; " > <div class= "> <div class=" cnfx_content "> <img align=" absmiddle "style=" float:left; margin:5px 10px 0; Display:none "src=" Http://www.3lian.net/jscss/demoimg/201109/ico_question.gif "&GT <table style= "width:350px; height:80px; " > <tbody> <tr> <td style= "vertical-align:top;" ><div class= "b_size" style= "padding-top:10px; Word-break:break-all; line-height:150%; " > <div> Delete     After the message will not be restored, are you sure you want to delete it? </div> </div> </td> </tr> </tbody> </table> </div> <div style= "Display: none; "class=" Cnfx_status "> <input type=" checkbox "id=" Qmconfirm__recordstatus "><label for=" qmconfirm__ RecordStatus "></label> </div> <div class=" cnfx_btn "> <input type=" button "value=" OK "id=" Qmconfirm__confirm "class=" Wd2 btn "><input type=" button "value=" Cancel "style=" display:; "id=" Qmconfirm__cancel " class= "wd2btn" ><input type= "button" value= "" style= "Display:none;" id= "Qmconfirm__never" class= "Wd2 btn" > </div> </div> </div> </td> </tr> </tbody> </table> </div> </div> </div> </span> </BODY>;/html>

The above is the entire contents of this article, I hope you can enjoy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.