首页 > 代码库 > js實現彈窗

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);
View Code

代碼中的 <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 =http://www.mamicode.com/‘" + strProp_InsKind + "‘;";
4  strJs += "var input=origin.document.getElementById(‘hideProp_No1‘);";
5  strJs += "input.value=http://www.mamicode.com/returnValue; ";
6 strJs += "origin.document.getElementById(‘btnHideT‘).click();";
7  strJs += " art.dialog.close();";
8   strJs += "</script>";
9 Page.ClientScript.RegisterStartupScript(this.GetType(), "Closed", strJs);
View Code

 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 = http://www.mamicode.com/$(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 = http://www.mamicode.com/$(this).attr("innerHTML").trim();
window.close();

 

js實現彈窗