求个两页面传值的js  至少能传5KB
例如 A.aspx中的TextBox控件:id="a"   向B.aspx的后台传值或者B.aspx中的TextBox控件传值都可以。
如果后台接值  要求形式如下:string message = string.Empty;
message = Request.Param.Get("此JS传来的参数");不允许使用Session,Application,Respose,Server.Transfer
有代码最好  提供思路也谢谢您  困扰我很多天了  高分求救!
如果不能实现  也请告诉我  
极度欢迎代码!

解决方案 »

  1.   

    那就得找个中间层来存放数据哟,比如数据库或xml文件存放
      

  2.   

    var bt=document.all('Name').value;
            bt.value='名称';
            ASP.NET中使用Name.Value来访问。
      

  3.   

    接受数据tt.html代码:<html>
     <head>
       <script language=javascript>
     function selectPerson(username_txt)
    {
     var indexes = window.showModalDialog("rr.html",form1,"dialogHeight:300px;dialogWidth:400px;help:no") + "";
     if (indexes!="undefined"){
       // alert("indexes = " + indexes);
        username_txt.value =  form1.username.value ; 
     }
    }
    </script>
     </head>  <body>
       <form name="form1" method="post">
     <input name="username" readonly ><a onclick="javascript:selectPerson(form1.username);" style="cursor: hand; color: #000000"><INPUT type="button" value="接受" name="btn1">
    </form>
     </body>
    </html>
    发送数据rr.html代码:<html>
     <head>
       <script language=javascript>
      function returnResult(){
         if(form2.username.value==""){
         alert("null");
      }else{
         form1 = window.dialogArguments;
      form1.username.value = form2.username.value;
      window.close();
      }
    }
    </script>
     </head>  <body>
       <form name="form2" method="post">
     <input name="username" value="derek">
     <input type="button" value="发送" onclick="returnResult()">
    </form>
     </body>
    </html>
      

  4.   

    ajax post
    var ajax = null;
    if (window.ActiveXObject) {
    ajax = new ActiveXObject("Msxml2.XMLHTTP");
    if (!ajax) {
        ajax = new ActiveXObject("Microsoft.XMLHTTP")
    }
    }
    else if (window.XMLHttpRequest) {
    ajax = new XMLHttpRequest
    }

    var url = "B.aspx";
    var obj = document.getElementById("a");
    var query = "text=" + window.encodeURIComponent ? encodeURIComponent(obj.value): escape(obj.value);
    ajax.open("POST",url,true);
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    ajax.send(query)
      

  5.   

    COOKIE最大只能4K吧A页面生成一个XML按时间命名
    B页面接受A穿过来的文件名读取XML并自定义销毁方式
      

  6.   

    应该是不能用XML和cookies  但是也很谢谢各位  特别是发出代码的  
    容我先我先试一下  
      

  7.   


      function CommentAdd()
        {
            ........
            var m_title = document.getElementById("comment_title").value;
            var m_content = document.getElementById("comment_content").value;
            var level=Comment_GetLevel();
            var url = "XX.aspx";
            var body = "comment_title=" + m_title + "&comment_content=" + m_content+"&level="+level;
            var http_request = CreateXMLHttpRequest();
            http_request.open('POST', url, true);
            http_request.setRequestHeader("Content-Length", body.length);
            http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            .........
            http_request.send(body);
        }
       //得用AJAX来POST数据到另一个页面.
      

  8.   

    顶楼上,只是这一个功能还犯不着用上AJAX,能简单解决就尽量简单好了
      

  9.   

    谢谢各位的建议  昨天发现了  是客户共通的问题  而且允许使用response了  各位的代码我也基本都试过了  虽然没成功(共通问题)  但是也学到不少知识  特别是提供代码的  真的很感谢  
    不废话了  发分!
      

  10.   

    我现在需要把click事件从后台写到前台js里  可能还会发帖子  到时候还欢迎大家