I have the following script that will be used to submit information to a search form on an existing page. The only problem is I need to have javascript automatically submit the form without extra user input. As soon as this page is loaded, it should submit itself (using the submit() in javascript).
Basically, the script works in IE but not FF.
FF javascript console reports this error: “Error: form.submit is not a function”
Does anyonve know why FF reports this or how to have the form submitted properly?
Here is the script (with real urls removed)
[code=html]<html>
<script language=”JavaScript” type=”text/JavaScript”>
document.open();
uri=’http://dfgdfgd’;
referer=’http://gdffdg’;
form=document.createElement(‘form’);
form.method=’post’;
form.action=uri;
form.action=referer;
i0=document.createElement(‘input’);
i0.type=’hidden’;
i0.name=’searchType’;
i0.value=’Basic’;
i1=document.createElement(‘input’);
i1.type=’text’;
i1.name=’firstname’;
i1.value=’someone’;
i2=document.createElement(‘input’);
i2.type=’text’;
i2.name=’lastname’;
i2.value=”;
i3=document.createElement(‘input’);
i3.type=’text’;
i3.name=’SearchTarget’;
i3.value=’Everyone’;
i4=document.createElement(‘input’);
i4.type=’submit’;
i4.name=’submit’;
i4.value=’Send Query’;
form.appendChild(i0);
form.appendChild(i1);
form.appendChild(i2);
form.appendChild(i3);
form.appendChild(i4);
b=document.createElement(‘body’);
b.appendChild(form);
h=document.getElementsByTagName(‘html’)[0];
h.appendChild(b);
form.submit();
</script>
</html>