shadiadiph Posted October 12, 2013 Share Posted October 12, 2013 Hi probably a simple answer but this is driving me nuts <script> function subform(ifrm,name,email) { var ifrm = document.getElementById(""+ifrm); //alert(name); ifrm.contentWindow.document.forms[0].elements[name].value = 'James'; ifrm.contentWindow.document.forms[0].elements[email].value = 'test@gmail.com'; //ifrm.contentWindow.document.forms[0].submit.click(); } window.onload = subform('adrian1','Name','Email'); </script> This script is filling in a form it only works if i alert(name); if i don't it does not work?? am i missing something or do i need to declare the name differently for example name value could be Name or FName or LName email could be Email e_mail Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/282902-javascript-working-if-i-alert-first/ Share on other sites More sharing options...
Solution shadiadiph Posted October 12, 2013 Author Solution Share Posted October 12, 2013 no problem i solved it Quote Link to comment https://forums.phpfreaks.com/topic/282902-javascript-working-if-i-alert-first/#findComment-1453628 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.