<!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>div浮動層</title> </head> <body> <div style="padding-top: 20px;"> <input type="submit" name="" value="浮動層"onclick="javascript:showDiv()" /> </div> </body> <div id=win style="display:none; POSITION:absolute; left:50%; top:50%; width:400px; height:180px; margin-left:-230px; margin-top:-50px; border:1px solid #888; background-color:#FF0000; text-align:center"> <div style="clear: both;"></div><!--撐開位置折行--> <li class="form-item action-verifycode" ><label style="width: 200px; height:30px;">讓咱們肯定您不是機器人</label></li> <a style="margin:25px 0px 25px 3px;" href="#" onclick="closeLogin()" class="btn" ><span><span>取消</span></span></a> </div> </body> </html> <script> function showDiv(){ document.getElementById('win').style.display='block'; } function closeLogin(){ document.getElementById("win").style.display="none"; var h = document.getElementById("id_verifycode"); h.removeClass('disabled'); var a=document.getElementById ("span"); a.innerHTML = "重發驗證碼"; } </script>