<div class="codetitle"> <span><a style="CURSOR: pointer" data="13132" class="copybut" id="copybut13132" onclick="doCopy('code13132')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code13132"> <br> <br> <br> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <br><title>jquery弹出层实例</title> <br><script type="text/javascript" src="http://www.jqueryajax.com/wp-content/uploads/2009/03/jquery-132min1.js"></script> <br><script type="text/javascript"> <BR>$(function(){ <BR>$(".but").click(function(){ <BR>var str = "这里是信息内容,这里是信息内容!"; <BR>$(".form").html(str); <BR>$("#faqbg").css({display:"block",height:$(document).height()}); <BR>var yscroll =document.documentElement.scrollTop; <BR>$("#faqdiv").css("top","100px"); <BR>$("#faqdiv").css("display","block"); <BR>document.documentElement.scrollTop=0; <BR>}); <BR>$(".close").click(function(){ <BR>$("#faqbg").css("display","none"); <BR>$("#faqdiv").css("display","none"); <BR>}); <BR>}) <BR></script> <br><style type="text/css"> <BR>body,h2{margin:0 ; padding:0;} <BR>#faqbg{background-color:#666666; position:absolute; z-index:99; left:0; top:0; display:none; width:100%; height:1000px;opacity:0.5;filter: alpha(opacity=50);-moz-opacity: 0.5;} <BR>#faqdiv{position:absolute;width:400px; left:50%; top:50%; margin-left:-200px; height:auto; z-index:100;background-color:#fff; border:1px #8FA4F5 solid; padding:1px;} <BR>#faqdiv h2{ height:25px; font-size:14px; background-color:#8FA4F5; position:relative; padding-left:10px; line-height:25px;} <BR>#faqdiv h2 a{position:absolute; right:5px; font-size:12px; color:#FF0000} <BR>#faqdiv .form{padding:10px;} <BR></style> <br> <br><br> <br><br><div id="faqbg"></div> <br><div id="faqdiv" style="display:none"> <br><h2>信息窗口<a href="#" class="close">关闭</a> </h2> <br><div class="form"> <br>这里是提示信息!! <br><br> </div> <br> </div> <br><p align="center"> <br><input value="弹出" class="but" type="button"> <br><input type="button" value="关闭" class="close"> <br></p> <br> <br> <br> </div>