All,
I am trying to automate logging into a website, doing some work and closing out. I have it all complete, with one snag. The website I am trying to access requires submit to be a named value. When I put a value on the "submit" name, it does not pass it. If I try to do a hidden input type and name it submit, I can not use the document.form('form1').submit() -- I get Object doesn't support this property of method. (see
http://www.cfdev.com/support/kb/inde...single/id/1066 for another case).
Here is my code. If you remove the "name=submit", you don't get the Javascript error, but you also do not submit the value. If you try to say "<INPUT type=hidden name=submit value=Login>", you can't submit it and get the "Object" error above. Any suggestions?
<HTML>
<HEAD>
<script language=JavaScript>
function post()
{
var fdata = '<FORM name=frm1 id=frm1 action=http://server/login.php method=post><INPUT TYPE=hidden NAME=username value=user1><INPUT TYPE=hidden NAME=password value=password1><INPUT type=submit name=submit value=Login></FORM>';
var win2 = open('blank.htm', 'win2');
win2.document.open();
win2.document.write(fdata);
win2.document.forms['frm1'].submit();
}
</script>
</HEAD>
<BODY>
<input type=button onclick="post()" value="DO POST"><BR>
<div id=result align="center"></div>
</BODY >
</HTML>