js实现页面弹出框 弹出一个类似alert的窗口,上面有文本信息和图片显示。请问如何实现 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 给你个参考一下吧!Liger UI框架 http://www.lullabot.com/files/bt/bt-latest/DEMO/index.html效果在下面一点,Examples 那其它参考的:http://www.webdesignbooth.com/15-jquery-plugins-to-create-an-user-friendly-tooltip/ http://blog.csdn.net/xuexiaodong2009/archive/2011/06/18/6553292.aspx使用JS制作弹出框的几个小问题 <!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> <title>zell419</title><style>.info{ border:1px solid #dedede; position:relative; width:200px;}.msg{ position:absolute; left:100px; top:0px; display:none; border:3px solid #5B7790;}.msg img{ width:40%; height:40%;}</style><script> var toggle =function(obj){ var msg = obj.getElementsByTagName("div")[0]; msg.style.display= msg.style.display=="block" ?"none" :"block"; }</script></head> <body> <div class="info" onmouseover ="toggle(this);" onmouseout ="toggle(this);" > <img src="http://avatar.profile.csdn.net/8/0/2/2_hhk477.jpg" name="hhk477" /> <div class="msg"> <img src="http://avatar.profile.csdn.net/8/0/2/2_hhk477.jpg" /> <span>你是hhk477</span> </div></div><br /><div class="info" onmouseover ="toggle(this);"> <img src="http://avatar.profile.csdn.net/0/8/9/2_zell419.jpg" name="zell419"/> <div class="msg"> <img src="http://avatar.profile.csdn.net/0/8/9/2_zell419.jpg" /> <span>我是zell419</span> </div></div></body></html>大概就这样 。 <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>提示信息框</title><style type="text/css">a{ color:#000; font-size:12px;text-decoration:none}a:hover{ color:#900; text-decoration:underline}body{background:;filter:progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#ffffff,endColorStr=#003366); overflow:hidden}#massage_box{ position:absolute; left:expression((body.clientWidth-350)/2); top:expression((body.clientHeight-200)/2); width:350px; height:200px;filter:dropshadow(color=#666666,offx=3,offy=3,positive=2); z-index:2; visibility:hidden}#mask{ position:absolute; top:0; left:0; width:expression(body.scrollWidth); height:expression(body.scrollHeight); background:#666; filter:ALPHA(opacity=60); z-index:1; visibility:hidden}.massage{border:#036 solid; border-width:1 1 3 1; width:95%; height:95%; background:#fff; color:#036; font-size:12px; line-height:150%}.header{background:#036; height:10%; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; padding:3 5 0 5; color:#fff}</style><!--实现层移动--><script language="javascript">var Obj=''document.onmouseup=MUpdocument.onmousemove=MMovefunction MDown(Object){Obj=Object.iddocument.all(Obj).setCapture()pX=event.x-document.all(Obj).style.pixelLeft;pY=event.y-document.all(Obj).style.pixelTop;}function MMove(){if(Obj!=''){ document.all(Obj).style.left=event.x-pX; document.all(Obj).style.top=event.y-pY; }}function MUp(){if(Obj!=''){ document.all(Obj).releaseCapture(); Obj=''; }}</script></head><body><div id="massage_box"><div class="massage"><div class="header" onmousedown=MDown(massage_box)><div style="display:inline; width:150px; position:absolute">本站提示信息</div><span onClick="massage_box.style.visibility='hidden'; mask.style.visibility='hidden'" style="float:right; display:inline; cursor:hand">×</span></div><ul style="margin-right:25"><li>本人申明此博客所有文章(包括文章插图)均为原创,如需引用或转载请注明出处。 </li><li>欢迎大家对博文中观点留言评述,谢绝无聊人士无素质无观点的灌水漫骂。</li><li>本站已设背景音乐,听音乐盒中收集的音乐时请先到页面底部关闭背景音乐。</li></ul></div></div><div id="mask"></div><span onClick="mask.style.visibility='visible';massage_box.style.visibility='visible'" style="cursor:hand"><a href="#">显示提示信息</a></span><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><p>查找更多代码,请访问:<a href="http://www.lanrentuku.com" target="_blank">懒人图库</a></p></body></html>http://www.lanrentuku.com/js/window.html <html><head> <meta charset="utf-8"/></head><body style="position:absolute"> <button onClick="createDialog()" id="test">click me</button> <p> 这是文字这是文字这是文字这是文字这是文字这是文 字这是文字这是文字这是文字这是文字这是文字这是 文字这是文字这是文字这是文字这是文字这是文字这 是文字这是文字这是文字这是文字这是文字这是文字 这是文字这是文字这是文字这是文字这是文字这是文 字这是文字这是文字这是文字这是文字这是文字这是 文字这是文字这是文字这是文字这是文字这是文字 </p></body><script> function createDialog(){ var div = document.createElement("div"); div.appendChild(document.createTextNode("this is a dialog test")); div.style.zIndex = "999"; //1 div.style.width = "500px"; div.style.height = "500px"; div.style.position = "absolute"; // 2 div.style.top = "10px"; div.style.backgroundColor = "red"; document.body.appendChild(div); }</script></html> js 解析 xml 有什么办法能兼容 chrome 浏览器? IE8,无法启用脚本调试,悲剧了。。。 JS取对象的问题..求解 onclick事件不执行的原因! 谁有打开网时间,图片由模糊慢慢变清晰了的代码??在此先谢了!! 这个选择省份和城市的javascript 求一用JavaScript编写的时间输入界面! 为什么打开时窗口不能是满屏。。大家帮我改一下 可不可能用javascript在两个html页面之间传递参数?急!!! html问题:如何刷新frameset里面调用的html页面(kingofark) JavaScript 获得输入div光标的位置 获取js中的一个变量值
效果在下面一点,Examples 那
其它参考的:
http://www.webdesignbooth.com/15-jquery-plugins-to-create-an-user-friendly-tooltip/
使用JS制作弹出框的几个小问题
<!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>
<title>zell419</title>
<style>
.info
{
border:1px solid #dedede;
position:relative;
width:200px;
}
.msg
{
position:absolute;
left:100px;
top:0px;
display:none;
border:3px solid #5B7790;
}
.msg img
{
width:40%;
height:40%;
}
</style>
<script>
var toggle =function(obj){
var msg = obj.getElementsByTagName("div")[0];
msg.style.display= msg.style.display=="block" ?"none" :"block";
}
</script>
</head>
<body> <div class="info" onmouseover ="toggle(this);" onmouseout ="toggle(this);" >
<img src="http://avatar.profile.csdn.net/8/0/2/2_hhk477.jpg" name="hhk477" />
<div class="msg">
<img src="http://avatar.profile.csdn.net/8/0/2/2_hhk477.jpg" />
<span>你是hhk477</span>
</div>
</div><br />
<div class="info" onmouseover ="toggle(this);">
<img src="http://avatar.profile.csdn.net/0/8/9/2_zell419.jpg" name="zell419"/>
<div class="msg">
<img src="http://avatar.profile.csdn.net/0/8/9/2_zell419.jpg" />
<span>我是zell419</span>
</div>
</div>
</body>
</html>大概就这样 。
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>提示信息框</title>
<style type="text/css">
a{ color:#000; font-size:12px;text-decoration:none}
a:hover{ color:#900; text-decoration:underline}
body{background:;filter:progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#ffffff,endColorStr=#003366); overflow:hidden}
#massage_box{ position:absolute; left:expression((body.clientWidth-350)/2); top:expression((body.clientHeight-200)/2); width:350px; height:200px;filter:dropshadow(color=#666666,offx=3,offy=3,positive=2); z-index:2; visibility:hidden}
#mask{ position:absolute; top:0; left:0; width:expression(body.scrollWidth); height:expression(body.scrollHeight); background:#666; filter:ALPHA(opacity=60); z-index:1; visibility:hidden}
.massage{border:#036 solid; border-width:1 1 3 1; width:95%; height:95%; background:#fff; color:#036; font-size:12px; line-height:150%}
.header{background:#036; height:10%; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; padding:3 5 0 5; color:#fff}
</style>
<!--实现层移动-->
<script language="javascript">
var Obj=''
document.onmouseup=MUp
document.onmousemove=MMovefunction MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}function MMove(){
if(Obj!=''){
document.all(Obj).style.left=event.x-pX;
document.all(Obj).style.top=event.y-pY;
}
}function MUp(){
if(Obj!=''){
document.all(Obj).releaseCapture();
Obj='';
}
}
</script>
</head><body>
<div id="massage_box"><div class="massage">
<div class="header" onmousedown=MDown(massage_box)><div style="display:inline; width:150px; position:absolute">本站提示信息</div>
<span onClick="massage_box.style.visibility='hidden'; mask.style.visibility='hidden'" style="float:right; display:inline; cursor:hand">×</span></div>
<ul style="margin-right:25"><li>
本人申明此博客所有文章(包括文章插图)均为原创,如需引用或转载请注明出处。
</li><li>欢迎大家对博文中观点留言评述,谢绝无聊人士无素质无观点的灌水漫骂。</li><li>本站已设背景音乐,听音乐盒中收集的音乐时请先到页面底部关闭背景音乐。</li></ul></div></div>
<div id="mask"></div>
<span onClick="mask.style.visibility='visible';massage_box.style.visibility='visible'" style="cursor:hand"><a href="#">显示提示信息</a></span>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><p>查找更多代码,请访问:<a href="http://www.lanrentuku.com" target="_blank">懒人图库</a></p></body>
</html>
http://www.lanrentuku.com/js/window.html
<html>
<head>
<meta charset="utf-8"/>
</head>
<body style="position:absolute">
<button onClick="createDialog()" id="test">click me</button>
<p>
这是文字这是文字这是文字这是文字这是文字这是文
字这是文字这是文字这是文字这是文字这是文字这是
文字这是文字这是文字这是文字这是文字这是文字这
是文字这是文字这是文字这是文字这是文字这是文字
这是文字这是文字这是文字这是文字这是文字这是文
字这是文字这是文字这是文字这是文字这是文字这是
文字这是文字这是文字这是文字这是文字这是文字
</p>
</body>
<script>
function createDialog(){
var div = document.createElement("div");
div.appendChild(document.createTextNode("this is a dialog test"));
div.style.zIndex = "999"; //1
div.style.width = "500px";
div.style.height = "500px";
div.style.position = "absolute"; // 2
div.style.top = "10px";
div.style.backgroundColor = "red";
document.body.appendChild(div);
}
</script>
</html>