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 32 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
| <!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>面向对象-弹窗组件</title> <style type="text/css"> *{ margin: 0;padding:0;list-style: none} .dialog{ position: absolute;border:1px solid #ccc;z-index: 10000} .dialog .title{ width: 100%;height: 26px;background: gray;color:white;} .dialog .content{ background: white} .dialog .title .close{ float: right} #mark{ width: 100%;height: 100%; background: black;filter:aphla(opacity=60);opacity: 0.6;position: absolute;top:0;left:0;z-index: 9999} </style> <script type="text/javascript" src="dialog.js"></script> <script type="text/javascript"> window.onload=function() { var btn1 = document.getElementById('btn1'); var btn2 = document.getElementById('btn2'); var btn3 = document.getElementById('btn3'); btn1.onclick = function() { var dialog1 = new Dialog(); dialog1.init({ id: 'btn1', width: 600, height: 400, title: '登陆' }); } btn2.onclick = function() { var dialog2 = new Dialog(); dialog2.init({ id: 'btn2', width: 100, height: 200, title: '公告', dir: 'rightBottom' }); } btn3.onclick = function() { var dialog3 = new Dialog(); dialog3.init({ id: 'btn3', width: 300, height: 200, title: '广告', dir: 'leftBottom', mark: true }); } } </script> <body> <input id="btn1" type="button" value="登陆"/> <input id="btn2" type="button" value="公告"/> <input id="btn3" type="button" value="广告"/> </body> </html>
|