<scriptlanguage="javascript">function datacheck() {var win= window.showModalDialog("test1.asp?x",self,""); 
} </script> <formname="input1" METHOD="POST"> <inputtype="text" name="txt" value="xxxxx"> <inputtype="button" value="确认提交" onClick="datacheck();"> </form> test1.asp 
<script>var win; 
window.onload=function(){ 
  win= window.dialogArguments;var f= document.forms[0]; 
  f.txt.value= win.document.input1.txt.value; 
}function subit(){var f= document.forms[0]; 
  f.action="xxxx.xx"; 
  f.target="hf";// 递交到隐藏的iframe  f.submit(); 
} </script> <form> <input type="text" name="txt"> <inputtype="button" onclick="subit();" value="递交"> </form> <iframename="hf" style="display:none;"> </iframe> 
标红色的是在弹出的子窗口中接收父窗口的参数 我现在不想用 type="text" 接收  能不能换成用<%=request("txt")%>这种格式直接显示  不用文本框

解决方案 »

  1.   

    不行的,type的属性不支持动态传入的。你如果需要的话。可以多定义几个hidden的各个type的,根据你
    <%=request("txt")%>不同用js去赋值
      

  2.   

    main.htm
    <script language="javascript">
    function datacheck() { 
      var win = window.showModalDialog("test1.asp?x",self,"");
    }
    </script> 
    <form name="input1" METHOD="POST">
        <input type="text" name="txt" value="xxxxx">
      <input type="button" value="确认提交" onClick="datacheck();"> 
    </form> test1.asp
    <script>
    var win;
    window.onload=function(){
      win = window.dialogArguments;
      var f = document.forms[0];
      f.txt.value = win.document.input1.txt.value;
    }
    function subit(){
      var f = document.forms[0];
      f.action = "xxxx.xx";
      f.target="hf"; // 递交到隐藏的iframe
      f.submit();
    }
    </script>
    <form>
        <input type="text" name="txt"><input type="button" onclick="subit();" value="递交">
    </form>
    <iframe name="hf" style="display:none;"></iframe>
    楼上的能否帮忙改改  
      

  3.   

    换一个label标签,或者span标签啊
      

  4.   

    你可以直接在要显示文本的地方调用JS输出
    附test1.asp如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head><body>
    <script> 
    var win; 
    window.onload=function(){ 
      win = window.dialogArguments; 
      //var f = document.forms[0]; 
      //f.txt.value = win.document.input1.txt.value;
      //document.getElementById("txt").value="sss"; 

    function getValue()
    {
      win = window.dialogArguments;
      document.write(win.document.input1.txt.value); 
    }
    function subit(){ 
      var f = document.forms[0]; 
      f.action = "xxxx.xx"; 
      f.target="hf"; // 递交到隐藏的iframe 
      f.submit(); 

    </script> 
    <form> 
        <!--<input type="text" name="txt">  --><script>getValue();</script><input type="button" onclick="subit();" value="递交"> 
    </form> 
    <iframe name="hf" style="display:none;"> </iframe>
    </body>
    </html>
      

  5.   

    <label for="txt"></label><input type="text" name="txt">这样?
    不行啊
    楼上的高手请赐教
      

  6.   

    哈哈  4楼说的可行  谢谢
    还有一个问题:
    我在showModalDialog() 也就是test1.asp 中用了第三方的打印控件 
    <input type="button" id="btnPrint" value="打印预览(Alt+o)" accesskey="o" onClick="ReYoPrint.Preview()">
    <input type="button" id="btnPrint" value="直接打印(Alt+p)" accesskey="P" onClick="ReYoPrint.Print(true)">
    怎么一按打印预览 或者直接打印 就直接退出test1.asp 页面呢?  
    模态窗口不支持???要怎么解决呢?
      

  7.   

    因为我需要在showModalDialog 弹出的窗口上打印显示的内容  不知道如何解决 请高手赐教!
    我在showModalDialog() 也就是test1.asp 中用了第三方的打印控件 
    <input type="button" id="btnPrint" value="打印预览(Alt+o)" accesskey="o" onClick="ReYoPrint.Preview()"> 
    <input type="button" id="btnPrint" value="直接打印(Alt+p)" accesskey="P" onClick="ReYoPrint.Print(true)"> 
    怎么一按打印预览 或者直接打印 就直接退出test1.asp 页面呢?  
    模态窗口不支持???要怎么解决呢?