如题:<html>
<head>
<script language="javascript">
function c(){
document.forms[1].onSubmit= "return false ";
}
function a(){
//alert('我是a()');
document.forms[0].action = "a.jsp";
return true;
}
function b(){
//alert('我是b()');
document.forms[0].action = "b.jsp";
return true;
}
</script>
</head>
<body onload="c();">
<form method="get" onsubmit="return a();">
<input type="text" name="username" id="username">
<input type="submit">
</body>
</form>
</html>***************************************
怎么通过一种方法获取到 onsubmit里面的值(return a()),然后给它修改成onsubmit="return b()"
<head>
<script language="javascript">
function c(){
document.forms[1].onSubmit= "return false ";
}
function a(){
//alert('我是a()');
document.forms[0].action = "a.jsp";
return true;
}
function b(){
//alert('我是b()');
document.forms[0].action = "b.jsp";
return true;
}
</script>
</head>
<body onload="c();">
<form method="get" onsubmit="return a();">
<input type="text" name="username" id="username">
<input type="submit">
</body>
</form>
</html>***************************************
怎么通过一种方法获取到 onsubmit里面的值(return a()),然后给它修改成onsubmit="return b()"
--------------
属性都是可以更改的.
<html>
<head>
<script language="javascript">
function c(){
document.forms[0].onsubmit= function(){return false};
}
function a(){
alert('我是a()');
document.forms[0].action = "a.jsp";
return true;
}
function b(){
alert('我是b()');
document.forms[0].action = "b.jsp";
return true;
} </script>
</head>
<body onload="">
<form method="get" onsubmit="return a();">
<input type="text" name="username" id="username">
<input type="submit">
</body>
</form>
</html>
<html>
<head>
<script language="javascript">
function c(){
document.forms[0].onsubmit= function(){return b()};
}
function a(){
alert('我是a()');
document.forms[0].action = "a.jsp";
return true;
}
function b(){
alert('我是b()');
document.forms[0].action = "b.jsp";
return true;
}</script>
</head>
<body onload="c();">
<form method="get" onsubmit="return a();">
<input type="text" name="username" id="username">
<input type="submit">
</form>
</body>
</html>