Remember to put the code block under the form declaration, or the last time won't work.
<script type="text/javascript">
function concatenateFields() {
concatenateFields = '';
for(i=0;i<document.forms[0].length;i++) {
concatenateFields += document.forms[0].elements[i].name + '=' + document.forms[0].elements[i].value + "&" ;
}
return concatenateFields;
}
function changeAction(){
actionfile = 'try.php?';
document.forms[0].action = actionfile + concatenateFields();
alert(document.forms[0].action);
return false;
}
document.forms[0].onsubmit = changeAction
</script>

No comments:
Post a Comment