blog.ja168.netraindot.blog.chinaunix.net
liuxingyuyuni
全部博文(77)
2013年(1)
2010年(1)
2009年(17)
2008年(58)
叶绍琛
格伯纳
cynthia
Bsolar
浪花小雨
花好月不
glaye
lithink
douyaqia
xuguoxin
分类:
2008-04-09 16:58:23
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ""><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test</title> <style> *{ margin:0; padding:0; } #dialog{ position:absolute; left:50%; top:50%; width:300px; height:100px; line-height:100px; margin:-50px 0 0 -150px; text-align:center; background:#ffffff; border:1px #000 solid; z-index:999; font-size: 12px; } #shadow{ position:absolute; left:0; top:0; width:100%; height:100%; background:#cccccc; z-index:100; filter:alpha(opacity=80); opacity:0.8; } </style> <script type="text/javascript"> function $(id) { return document.getElementById(id); } function showDialog(info) { var shadow = document.createElement("div"); var dialog = document.createElement("div"); shadow.setAttribute("id", "shadow"); dialog.setAttribute("id", "dialog"); // Create button var button = document.createElement("input"); button.setAttribute("id", "bt"); button.setAttribute("type", "button"); button.setAttribute("value", "关闭"); // Create dialog text var dialogText = document.createTextNode(info); dialog.appendChild(dialogText); dialog.appendChild(button); var container = $("container"); container.appendChild(shadow); container.appendChild(dialog); } function hideDialog() { var container = $("container"); var shadow = $("shadow"); var dialog = $("dialog"); container.removeChild(shadow); container.removeChild(dialog); } window.onload = function() { var bt = $("callWinBt"); bt.onclick = function() { showDialog("测试一下!"); var bt2 = $("bt"); bt2.onclick = function() { hideDialog(); } }; } </script> </head> <body> <div id="container"> <input type="button" value="call window" id="callWinBt"> <img src="1.jpg" width="150" height=200 align="center"> <div> 文本文本文本文本文本文本文本文本文本文本文本文本文本文本 </div> </div> </body></html>
上一篇:使Div水平垂直居中
下一篇:PHPER第九期引有士兵突击台词[够创意]
登录 注册