gokul wrote on 28 Nov 2003:
Yes you can do that.
Please follow the steps as follows:
Lets assume form name is myForm
function onSubmit_activat(sURL)
{
document.myForm.action=sURL;
document.myForm.submit();
You should use the forms and elements collections to make the script
compatible with more browsers:
document.forms['myForm'].elements['action'] = sURL;
document.forms['myForm'].submit();
}
<form method="post" name="myForm" >
You shouldn't omit the action attribute, even if you can guarantee
that the user will have JavaScript enabled - it's invalid HTML. If
you can't guarantee that JavaScript will be enabled, you shouldn't
really attempt this method at all, but instead find another way of
presenting your website.
<textarea name="content">
Test
</textarea>
<input type="button" name="submit" value="submit"
onClick="javascript:onSubmit_activat('test.html')" >
At the present moment, your script will probably fail here. The name
of the control is submit, which is also a Form method. Some browsers
will get confused by this. Never name a submit button, submit, or a
reset button, reset. In fact, don't use any names that could collide
with those used by the Form object (lookup the properties and methods
of the Form object in a JavaScript reference).
Furthermore, if you write valid HTML, there should never be a need to
use the JavaScript protocol specifier (it's only supposed to be used
in URIs anyway, which again is discouraged). Specify the language of
intrinsic events with the following META element (placed in the
document HEAD):
<META http-equiv="Content-Script-Type" content="text/javascript">
<snipped other control and original post>
Mike
And please don't top-post. :)
--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)