当前位置: 代码迷 >> JavaScript >> 简单有关问题求解
  详细解决方案

简单有关问题求解

热度:10   发布时间:2012-02-22 19:36:55.0
简单问题求解!
一个表单包含有一个名称叫 "action "的element(具体偶不清楚,可能是个名字叫 "action "的隐藏的子控件),如果想修改表单的action方法,该如何做!(也就是有个action的element,和一个action的方法该如何区别)
不知道大虾能看懂不?偶也是替人问问题!谢谢!

------解决方案--------------------
把action元素改id和name~~~~~~然后……
------解决方案--------------------
form1.action= "xxx.cgi ";
form1.elements[ "action "].value = "xxxx ";
------解决方案--------------------
<!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=gb2312 " />
<title> 无标题文档 </title>
</head>

<body>
<form action= "Untitled-1.html " name= "form1 ">

<input type= "text " name= "action " />

</form>

</body>
</html>
<script type= "text/javascript ">


var oF = document.form1;

alert(oF.attributes.getNamedItem( "action ").nodeValue);

oF.attributes.getNamedItem( "action ").nodeValue = "Untitled-2.html ";

alert(oF.attributes.getNamedItem( "action ").nodeValue);

</script>

------解决方案--------------------
用无名函数
  相关解决方案