Jump to content

javascript working if i alert first?


shadiadiph
Go to solution Solved by 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 = '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

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.