TJS wrote:
what is wrong here, the submit will only post page back to itself instead of
specifed action
<SCRIPT language="Javascript">
function Submit_Form(){
document.Form1.Action="cart.asp";
document.Form1.submit();
return false;
}
</SCRIPT>
<FORM METHOD="get" Action="" NAME="Form1">
<INPUT TYPE="button" VALUE="Submit Information" OnClick="Submit_Form()">
</FORM>
I made a test page to change the action and some test target pages so I
could see what page the form was sent to, setting the action property
with javascript works on my IE 6, Netscape 7.2, and Firefox 1.
What browsers are you using?
I used simple test target pages:
default.htm <html><body>default</body></html>
index.htm <html><body>index</body></html>
initial.htm <html><body>initial</body></html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
function setaction(url){
document.forms['form1'].action=url;
}
function submitform(){
//document.forms['form1'].action="cart.asp";
document.forms['form1'].submit();
return false;
}
function showaction(){
alert('action = '+document.forms['form1'].action);
}
</script>
</head>
<body>
<FORM METHOD="get" Action="initial.htm" NAME="form1">
<br>Set action to "index.htm" <input type="button"
onclick="setaction('index.htm')"; value="index.htm">
<br>Set action to "default.htm" <input type="button"
onclick="setaction('default.htm')"; value="default.htm">
<br>
<br>Show current action <input type="button"
onclick="showaction()"; value="show action">
<br>
<br>Submit Form <INPUT TYPE="button" VALUE="Submit
Information" OnClick="submitform()">
</FORM>
</body>
</html>