直接修改form元素的action属性
document.all("form的ID").action = "";
document.all("XXX")可以取得ID或name为XXX的元素包括form
取得了form元素后直接改Action属性就行了
.action = "新的连接";

解决方案 »

  1.   

    尽可能少用ALL,增加其他浏览器的兼容性;
    document.forms['yourFormsName'].action = 'your destination';
      

  2.   

    document.forms['yourFormsName'].action 用alert输出提示为对象不好意思我忘说了,原有表单代码里建有<input type="hidden" name="action" value="dopost">,由于原来代码结构,不能改变其标签名,晕
      

  3.   

    <form action="test1.php" method="post" name="form1" target="_blank" id="form1">我是想改 form标签里的action属性的值,也就是"test1.php".
      

  4.   

    哦这样呀 最安全的写法是
    document.all["form的ID"].Attributes.item["action"] = "XXXXXXXX";
    为了兼容性:(这方面我没注意太多完全是用DHTML DOM的格式来写的 W3C标准)
    document.forms["form的ID"].Attributes.item["action"] = "XXXXXXXX";
      

  5.   

    哦 忘了还有个方法:
    document.all["form的ID"].setAttribute("action","XXXXXXXX");
      

  6.   

    document.all["form的ID"].setAttribute("action","XXXXXXXX");
    无法设置属性值
    document.forms["form的ID"].Attributes.item["action"];
    输出显示为对象??
      

  7.   

    哦 不好意思忘了点东西
    document.forms["form的ID"].Attributes.item["action"].value = "XXXXXXXXX";说明:
    attributes的item方法item Method  
    --------------------------------------------------------------------------------Retrieves an attribute for an element from the attributes collection.SyntaxoItem = attributes.item(vIndex)ParametersvIndex Required. "Integer" or "String" that specifies the attribute. If this parameter is an integer, it is the zero-based index of the attribute in the attributes collection. If this parameter is a string, the attribute whose name matches the string is retrieved. 
    参数可以是整数或字符串 如果是整数则以0为基数的索引位置 如果是字符串则是item的名称Return Value
    Returns an attribute if successful, otherwise null.
    返回值 
    返回一个属性
    attribute的 value属性value Property  --------------------------------------------------------------------------------Sets or retrieves the value of the object.Syntaxattribute.value(v) [ = sValue ]
    Possible ValuessValue String that specifies or receives the value. The property is read/write. The property has no default value.Expressions can be used in place of the preceding value(s), as of Microsoft&reg; Internet Explorer 5. For more information, see About Dynamic Properties.