string strJava="<script language='javascript'>document.frm1.txt1.value=window.showModalDialog('a.htm?xx=2','window','dialogHeight:700px;dialogWidth:720px;tools:no;status:no')</script>";
Page.RegisterClientScriptBlock("newwin",strJava);a.aspx is embed in a.htm关闭窗口时:
in page_load:
btnClose.Attributes["onclick"]="javascript:CloseWindow()";then in html:
function CloseWindow()
    {
top.returnValue=document.getElementById("txtvalue").value;
window.close();
    }

解决方案 »

  1.   

    1、使用window.showModalDialog()
    2、使用正直表达式。^\d+$
      

  2.   

    我有个例子 你参考参考var gcToggle = "#ffff00";
    var gcBG = "#CCCCFF";function Jetech_GetSelected(aCell)
    {   window.returnValue = aCell.innerText;
    window.close();
      
    }
    function getSelected(Names,values)
    {
       window.returnValue = Names+"!"+values;
    window.close();
    }//选机构、人、项目等
    function chooseWindow(url2,Width2,Height2){
    var showx2 = Width2; 
        var showy2 = Height2; 
    var features2 =
                    'width='  + Width2  +
    ', height=' + Height2 +
    ', left='   + showx2  +
    ', top='    + showy2  +
    ', directories=no, localtion=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizeable=no';
    popWindow2=window.open(url2,"",features2);
    }
    function receiveRef(dialogType,idObject,nameObject,Width,Height){
    var endtarget;
    if(dialogType == "SelectUnit"){
    endtarget = "unit/selectunit.jsp";

    }else if(dialogType=="SelectUser"){
      endtarget = "../person/select_person.jsp?idObject="+idObject+"&nameObject="+nameObject;
    }else if(dialogType=="SelectProject"){
      endtarget = "../project/select_project.jsp?idObject="+idObject+"&nameObject="+nameObject;
    }else if(dialogType=="SelectWork"){
      endtarget = "../project/projectWorkEdit.jsp?action="+idObject+"&workid="+nameObject;
        }else if(dialogType=="getpersoninfo"){
      endtarget = "../project/getpersoninfo.jsp?idObject="+idObject+"&nameObject="+nameObject;
       }else if(dialogType=="SelectUserInfo") {
    endtarget="../person/select_personinfo.jsp?idObject="+idObject+"&nameObject="+nameObject;
    }

    showx = event.screenX - event.offsetX - Width ; // + deltaX;
         showy = event.screenY - event.offsetY - Height - 30; // + deltaY;
        

    var features =
                    'width='  + Width  +
    ', height=' + Height +
    ', left='   + showx  +
    ', top='    + showy  +
    ', directories=no, localtion=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizeable=no';
    popWindow=window.open(endtarget,"",features);
    }function fPopUpDlg(dialogType,ctl1,ctl2,WINwidth,WINheight){
    // alert("lskdfj;ladkfj;fj");
    var endtarget;
    if(dialogType == "SelectUnit"){
    endtarget = "../unit/selectunit.jsp";
    alert(endtarget);
    }else if(dialogType=="SelectUser"){
    endtarget = "../select_person.jsp";
    }


    showx = event.screenX - event.offsetX - 4 - WINwidth ; // + deltaX;
    showy = event.screenY - event.offsetY + 18; // + deltaY; if (dialogType == "POPUPLIST_CONTRACTSTOP"){
        showx = event.screenX - event.offsetX - WINwidth + 150; 
           showy = event.screenY - event.offsetY + 20;      

        
    newWINwidth = WINwidth + 4 + 18;
    var features =
    'dialogWidth:'  + newWINwidth  + 'px;' +
    'dialogHeight:' + WINheight + 'px;' +
    'dialogLeft:'   + showx     + 'px;' +
    'dialogTop:'    + showy     + 'px;' +
    'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:no;Resizeable=no';


    var accounts=ctl1.value+"!"+ctl2.value;

    retval = window.showModalDialog(endtarget,accounts,features);
    if( retval != null ){
        var token=retval.indexOf('!',0);
    ctl1.value =retval.substring(0,token);
    ctl2.value =retval.substring(token+1);
    }else{
    //alert("canceled");
    }
    }
    function fPopUpCalendarDlg(ctrlobj)
    {
    showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;
    showy = event.screenY - event.offsetY + 18; // + deltaY;
    newWINwidth = 210 + 4 + 18; retval = window.showModalDialog("../../inc/CalendarDlg.asp", "", "dialogWidth:197px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
    if( retval != null ){
    ctrlobj.value = retval;
    }else{
    //alert("canceled");
    }
    }function select_xs(obj)
    {
    var openurl="../../inc/xs_select/xs_select.asp";
    retval=new Array("","");
    retval=window.showModalDialog(openurl,'Select_XS',"dialogWidth:600px; dialogHeight:400px; dialogLeft:40px; dialogTop:40px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
    if ((obj != null) && (retval != null))
    {
    obj.value=retval[1];
    }
    if ((obj==null) && (retval !=null))
    {
    document.all.xs.value=retval[0];
    document.all.dw_list.value=retval[1];
    }
    }function select_xz()
    {
    var openurl="../../inc/xz_select/xz_select.asp";
    window.open(openurl,'Select_XZ','scrollbars=yes,top=40,left=40,height=360,width=420');
    }function select_xzqh(obj)
    {
    var openurl="../../inc/xzqh_select/xzqh_select.asp";
    retval=new Array("","");
    retval=window.showModalDialog(openurl,'Select_XZQH',"dialogWidth:600px; dialogHeight:540px; dialogLeft:40px; dialogTop:40px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
    //retval=window.open(openurl);
    if ((obj != null) && (retval != null))
    {
    obj.value=retval[1];
    }}
      

  3.   

    <html>
    <head>
    <title>选择籍贯所在地</title>
    </head>
    <script language="JavaScript">
    function setinfo(jgm,jg) 
    {
    alert(jgm);
    alert(jg);
    return true;
    }
    </script><frameset rows="*" cols="33%,33%,34%">
    <frame src="listjg.asp" name="content" frameborder="0" target="selected1">
    <frame src="selectedjg1.asp" name="selected1" frameborder="0" target="selected2">
    <frame src="selectedjg2.asp" name="selected2" frameborder="0">
    </frameset>
    <noframes><body bgcolor="#FFFFFF" text="#000000">
    </body></noframes>
    </html>
      

  4.   

    回答能不能有点深度
    我用的是 VB NET 请注意语言哦不要乱UP贴子