我知道有一種方式可以顯示一個新窗口,固定在屏幕上,而另一部分網站會禁用並在黑暗和透明的封面下。但是我不知道這些方法和技巧名稱。所以我寫我自己的代碼來創造類似的東西。 我的問題是,這樣做的常用方法是什麼?這裏是我的代碼...
在'onclick'事件上打開一個固定窗口 - JavaScript&html
<!DOCTYPE HTML>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<div id="bg_cover">
</div>
<div id="inside_box">
</div>
<div>
<form>
<label>
<input type="button" value="run" onclick="sign_go()">
</label>
</form>
</div>
<script>
function sign_go() {
document.getElementById('bg_cover').style='z-index:80; background-color:#003399; position:fixed; top:0; left:0; height:100%; width:100%; opacity:0.5;';
document.getElementById('inside_box').style='z-index:90; background-color:white; position:fixed; left:0; right:0; height:100px; width:300px; margin:auto; margin-top:100px;';
document.getElementById('inside_box').innerHTML='<form><label><input type="text"><input type="button" onclick="sign_back()"></label></form>';
}
function sign_back(){
document.getElementById('bg_cover').style='';
document.getElementById('inside_box').style='';
document.getElementById('inside_box').innerHTML='';
}
</script>
</html>
嘗試搜索jQuery的模態 – Sushil
模式......... – Spechal