
November 10th, 2000, 10:56 PM
|
|
Junior Member
|
|
Join Date: Nov 2000
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I am trying to submit a form using the document object in a JavaScript (client) function. My problem is that it doesn't work if my target frame is the same as the current frame I am in---it only works if the target frame is different. However, when I don't use JavaScript, but instead assign the form attribute values in my HTML---it DOES work. When it works, my current frame changes to the new page I am sending to the frame. When it doesn't work, the frame doesn't change but just retains the current page. The following Example 1 is the JavaScript that does NOT work (along with the HTML form tag info). Example 2 is the pure HTML solution that does work (as you can see I have to include the "submit" input type button, which I don't want to do).
Thanks. Bartel.
Example 1 (DOES NOT work!)
document.MyFormName.method = "post";
document.MyFormName.action = "my.asp";
document.MyFormName.value = "add";
document.MyFormName.target = "MyFrame";
document.MyFormName.MyInputName.value = "MyValue";
document.MyFormName.submit();
<form name="MyFormName">
<input type="hidden" name="MyInputName">
</form>
Example 2 (works!)
<form name="MyFormName" method="post" action="my.asp" value="add" target="MyFrame">
<input name="MyInputName" type="submit" value="MyValue">
</form>
|