js實現彈窗
Posted wonderfulviews
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js實現彈窗相关的知识,希望对你有一定的参考价值。
1 strSucc += "<br/><font color=\\"red\\">提醒您!在預設狀態下,Google Chrome 會阻止彈出式視窗自動在畫面上顯示。</font>"; 2 strSucc += "<br/><font color=\\"red\\">請記得將彈出式視窗的設定調整為允許,謝謝</font>"; 3 strSucc += "<br/><font color=\\"red\\">設定方式可上網參考chrome瀏覽器彈出式視窗設定步驟</font>"; 4 5 String strAlertMess = "$(\'#light\').remove();$(\'#fade\').remove();var dialog = art.dialog({ title: \'提示信息\',content: \'" + strSucc + "\',icon: \'succeed\',drag: false,resize: false, lock: true,dblclick_hide: false,ok: function () { var element =document.getElementById(\'ToolBarSaveButton_01\'); if(element ==null){var element =document.getElementById(\'ToolBarSaveButton_02\');} element.click(); } ,close:function () { $(\'#hideClickType\').val(\'0\')} });"; 6 7 ScriptManager.RegisterStartupScript(this, GetType(), "", strAlertMess,true);
代碼中的 <font color=\\"red\\">添加轉苡符號,因為content 后接的是\'\' color =\'red\'會對他有影響。
String strPage = "$(\'#light\').remove();$(\'#fade\').remove();try_to_open_app(\'" + strUrlTemp + "\');";//也可以將裡面的方法寫在前臺,作為方法調用。
1 strJs = "<script language=javascript>"; 2 strJs += "var origin = artDialog.open.origin;"; 3 strJs += "var returnValue =\'" + strProp_InsKind + "\';"; 4 strJs += "var input=origin.document.getElementById(\'hideProp_No1\');"; 5 strJs += "input.value=returnValue; "; 6 strJs += "origin.document.getElementById(\'btnHideT\').click();"; 7 strJs += " art.dialog.close();"; 8 strJs += "</script>"; 9 Page.ClientScript.RegisterStartupScript(this.GetType(), "Closed", strJs);
Page.ClientScript.RegisterStartupScript(this.GetType(), "Closed", strJs)的使用
頁面跳轉
function OpenWindow() { art.dialog.open("AFN-0201-12.aspx", { id: \'agent_dialog\', lock: true, width: 470, height: 300, title: \'\', drag: false, resize: false, style: "overflower:auto", opacity: 0, close: function () { } }, false); return false; }
父:var ret = showModalDialog("BFN-0205-1.aspx?k=0&&ran=" + Math.random(), "商品代號", "dialogWidth:800px;dialogHeight:530px;center:yes;help:no;resizable:no;status:no");
if (ret != null && ret != undefined && ret != "") {
$("#txtMascontract2").val(ret);
}
else {
return false;
}
子: window.returnValue = $(this).attr("innerhtml").replace(/^\\s*|\\s*$/g, "");
window.close();
谷歌瀏覽器
父 :var ret = window.open("BFN-0205-1.aspx?k=0&&ran=" + Math.random(), \'商品代號\', "height=520,width=800,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no");
子 :window.opener.document.getElementById("txtMascontract2").value = $(this).attr("innerHTML").trim();
window.close();
以上是关于js實現彈窗的主要内容,如果未能解决你的问题,请参考以下文章