『壹』 如何用js實現滑鼠劃過SVG中的元素 彈出DIV層
onmousemove 必須寫在svg中,但svg中無法識別html的div標簽,我試了一下 可以alert信息。但不能載入HTML元素
別用embed。直接用svg嵌進去試試。
『貳』 JS彈出DIV窗口,按ESC取消
顯示層:
css:
.showdiv
{
width: 100%;
height: auto;
position: absolute;
left: 0;
top: 0;
z-index: 999;
display: none;
}
.count_div
{
width: 500px;
height: 400px;
margin-top: 120px;
margin-left: auto;
margin-right: auto;
margin-bottom: 0;
border: 1px solid #aaaaaa;
background: #fff;
}
.brg
{
width: 100%;
background: #ededed;
position: absolute;
top: 0;
left: 0;
filter: alpha(opacity=60);
-moz-opacity: 0.6;
opacity: 0.6;
position: absolute;
top: 0;
left: 0;
display: none;
z-index: 998;
}
js:
function close () {
$("#brg").css("display", "none");
$("#showdiv").css("display", "none");
}
function show() {
$("#brg").css("display", "none");
$("#div_show").css("display", "none");
}
$(document).bind('keydown', 'esc',function (evt){
//關閉層代碼
close () ;
return false; });
html:
<!--遮罩層-->
<div class="brg" id="brg">
</div>
<!--顯示層-->
<div class="showdiv" id="div_order">
<div class="count_div" id="div_order_count">
內容
</div>
</div>
在網上找一個「jquery.hotkeys.js」的js包,裡面都是jquery整理好的熱鍵,
引入jquery包。
$(document).bind('keydown', 'esc',function (evt){
//關閉層代碼
return false; });
手敲,未測試,應該不會有太大問題,根據自己內容修改
『叄』 js如何實現點擊圖片彈出窗口並放大這張圖片,彈出的窗口有半透明遮罩層效果,彈出的窗口不跳頁面
通過JS代碼 document.getElementById('divID').style.etElementById('divID').style.display = 'none'。函數可以實現。
『肆』 javascript實現在一個新的標簽頁彈出一個新的窗口。
是我截的這種來效果嗎?
如果是源的話,這種的是div彈出層,這是調用的jquery-ui-1.7.3.custom.min.js文件,你可以到網上找這個文件,文件中包含$("#div_Add").dialog()的使用
如果不是,那就是模態窗口,用window.showModalDialog,但這個兼容性不好,有些瀏覽器不支持
請在此輸入您的回答