Jump to content

javascript working if i alert first?


shadiadiph

Recommended Posts

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 = '[email protected]'; 
//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

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/282902-javascript-working-if-i-alert-first/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.