看看这片文章
http://www.21ds.net/article/article.php/630

解决方案 »

  1.   

    楼主误解了,s应是提交内容编码后的结果。楼主可看:http://developer.mozilla.org/cn/docs/AJAX:%E5%BC%80%E5%A7%8B
      

  2.   

    用这个可以,需要配合prototype.js一起使用
    /* ajaxForm Object - submiting form using ajax method
    * author: ice_berg16(寻梦的稻草人)
    * version: 1.0
    * last modified: 2006-1-5
    * copyright(c) [email protected]
    *   this file is free, you can use it for any purpose.
    * bug or suggestion can be sent me via my email.
    *   ==========================================================
    *   <usage>
    * var af = new ajaxForm( document.form[0] );
    * af.submit();
    *   <notice>
    * the method will add a variable named "useAjax" whitch value is 1;
    * so you can check it on the server side to determine if the form is submit by ajaxForm
    * and display difference content for normal output and ajax output.
    */
    function ajaxForm(form)
    {
    this.activeForm = form; //the form to process
    this.callback = arguments.length > 1 ? arguments[1] : null;
    this.submitingText = "正在提交数据..."; //tip text when submiting form
    this.successText = "提交成功."; //tip text when submit success
    this.failedText = "提交失败."; //tip text when submit failed
    this.successCode = "SUBMIT_OK"; //submit success code response by server
    if(arguments.length > 2)this.setFormContainer(arguments[2]); //form container use to toggle display
    this.init();
    }
    ajaxForm.prototype = {
    //create the container for display the message;
    init : function(){
    this.msgContainer = document.createElement("div");
    this.msgContainer.style['position'] = 'absolute';
    this.msgContainer.style['width'] = '120px';
    this.msgContainer.style['height'] = '30px';
    this.msgContainer.style['border'] = '1px solid #32B13F';
    this.msgContainer.style['background'] = '#DDF1D8';
    this.msgContainer.style['lineHeight'] = '30px';
    this.msgContainer.style['textAlign'] = 'center';
    this.msgContainer.style['fontSize'] = '12px';
    this.msgContainer.style['visibility'] = 'hidden';
    document.body.insertBefore( this.msgContainer, document.body.firstChild );
    },
    //提交表单的方法
    submit : function(){
    //calllback function to process the form usually is validate.
    if( this.callback && !this.callback(this.activeForm) ) return false;
    Form.disable( this.activeForm );
    this.showTip();
    var url  = this.activeForm.action;
    var met  = this.activeForm.method;
    var par  = this.buildParam();
    var self = this;
    var hand = function(response){self.handler(response)};
    var ajax = new Ajax.Request(url, { method:met, parameters:par, onComplete:hand });
    },
    //处理返回结果的方法
    handler : function( response ){
    if( response.responseText == this.successCode )
    this.msgContainer.innerHTML = this.successText;
    else
    this.msgContainer.innerHTML = "<span class='red-font'>" + this.failedText + "</span>";
    Form.enable( this.activeForm );
    //if want to toggle container's display
    if( this.formContainer )
    this.toggleContainerDisplay();
    this.setTipPosition();
    this.hideTip();
    },
    //构建表单提交参数
    buildParam : function(){
    var pairs = [];
    for(var i=0;i<this.activeForm.length;i++)
    {
    var e = this.activeForm.elements[i];
    //we must get rid of the input which can not be submit by the real form
    if( e.tagName.toLowerCase() == "input" )
    {
    if( e.type.toLowerCase() == "button" )
    continue;
    if( (e.type.toLowerCase() == "radio" || e.type.toLowerCase() == "checkbox") && e.checked == false )
    continue;
    }
    pairs.push( e.name + "=" + e.value );
    } //add flag for ajaxForm used
    pairs.push( "useAjax=1" );
    return pairs.join("&");
    },
    //显示提示信息
    showTip : function(){
    this.setTipPosition();
    this.msgContainer.innerHTML   = this.submitingText;
    this.msgContainer.style['visibility'] = 'visible';
    },
    //隐藏提示信息
    hideTip : function(){
    var self = this;
    var f = function(){
    self.msgContainer.style['visibility'] = 'hidden';
    }
    window.setTimeout( f, 1000 );
    },
    setTipPosition : function(){
    this.msgContainer.style['left'] = (document.documentElement.offsetWidth - 160) + "px";
    this.msgContainer.style['top']  = (document.documentElement.scrollTop + 10) + "px";
    },
    setFormContainer : function( container ){
    if( typeof container == "string" )
    this.formContainer = document.getElementById( container );
    else
    this.formContainer = container;
    },
    toggleContainerDisplay : function(){
    var currentDisplay,defaultDisplay;
    //IE the 'block' value works well
    if( document.all )
    {
    var currentDisplay = this.formContainer.currentStyle.display;
    var defaultDisplay = 'block';
    }
    else
    {
    //gecko, must check for the default display
    currentDisplay = document.defaultView.getComputedStyle(this.formContainer,null).getPropertyValue("display");
    switch( this.formContainer.tagName.toUpperCase() )
    {
    case "TABLE":
    defaultDisplay = "table";
    break;
    case "TR":
    defaultDisplay = "table-row";
    break;
    case "TD":
    case "TH":
    defaultDisplay = "table-cell";
    break;
    case "INPUT":
    case "SELECT":
    defaultDisplay = "inline-block";
    break;
    case "LI":
    defaultDisplay = "list-item";
    break;
    default:
    defaultDisplay = "block";
    }
    }
    if( currentDisplay == "none" )
    {
    this.formContainer.style.display = defaultDisplay;
    }
    else
    this.formContainer.style.display = "none";
    }
    }
      

  3.   

    asp的
    学习中^_^
    ASP小偷程序如何利用XMLHTTP实现表单的提交利用XMLHTTP来制作小偷的具体细节落伍很多人都发过和讨论过了,但是在制作ASP小偷的过程中,很多人就发现ASP小偷不如PHP小偷的那么强大了。确实,如果在原网站如果存在表单提交或cookies的验证,对于ASP来说,不使用基于SOCKET的组件就难以完成,其实,XMLHTTP的另外两个方法被我们忽略了,而这正是问题的关键。
    下面首先来说说这个方法
    1。.send()
    由于流行的小偷是使用的GET而不是POST来传送数据,所以很多人忽略了这个方法,而使用SEND发送数据也很简单,就是SEND("内容"),可是,发送表单就不是这么简单,因为你发送的表单如果是中文的话,就要牵扯到编码的问题了。
    首先,你在OPEN 时要确定是用POST 即 .open("POST",地址,是否异步)
    然后,在SEND里面加上你表单的内容,比如说,你要提交的表单有3个表单域,分别是A,B,C,对应的值分别是1,2,3,那么,你在SEND里这样写就可以提交表单了,.send("A=1&B=2&C=3"),怎么样,很简单吧,是不是没想到呢?但是别高兴的太早了,我前面说到了,如果表单的值是中文的话,数据传输的就会出错了。这里我们借助一个函数escape(),熟悉JAVASCRIPT的朋友都应该知道这个函数的作用了,现在VBSCRIPT同样支持这个函数。.send("A=escape('值1')&B=escape('值2')&C=escape('值3')")
    2。.setRequestHeader()
    接着上面的所说,你的数据send出去了,对方却不会接收到,为什么了,其实,那是因为你的HTTP头少了一个东西,然后用这个函数把加上去就可以了,具体就是.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded"), 告诉对方你是提交了一个urlencode编码的表单。好的,说完了表单的提交来说怎么传送cookies和session
    其实传送cookies也很简单了,同样利用这个函数在HTTP头里添加东西,比如,我当前在落伍的cookies是
    cdb_sid=ybBiK0; cdb_cookietime=315360000; cdb_oldtopics=D869008D; cdb_visitedfid=1D45; cdb_auth=AQYHXVFDGERdsggVQA1VYUgxQDwFVV1dUAlwFAFRXVwU%2FbAIJB1lUCg; cdb_fid45=1113370145
    现在我要发送这个cookies就直接是.setRequestHeader("Cookie","cdb_sid=ybBiK0; cdb_cookietime=315360000; cdb_oldtopics=D869008D; cdb_visitedfid=1D45; cdb_auth=AQYHXVFDGERdsggVQA1VYUgxQDwFVV1dUAlwFAFRXVwU%2FbAIJB1lUCg; cdb_fid45=1113370145")
    当然,有些网站页面有页面判断功能,这个也不难,就是.setRequestHeader("Referer","来路的绝对地址")
    这里还有个重要问题,就是这个方法由于是写HTTP头的,所以不能更改现有的HTTP头,对于怎么用asp获取对方页面的cookies或session并且发出去.