Iframe Passthrame

I would appreaciate if you could give me a hand in this javascript in the codebehind of a C# asp.net page. What I want to do is have a button, which when pressed will do the following:

  1. create a frame or iframe or something like that

  2. go to page within that frame

  3. login to that page by focusing on specific form elements and then submiting the form

  4. Redirect to that logged in page

Here is what I have managed until now:

<iframe id="logonframe" src="https://.com" style="width: 100%; height: 200px; border:none;"></iframe>

              <script language=Javascript>
                  function paybutton() 
                      document.domain = "https://.com";
                      var oIframe = document.getElementById("logonframe");
                      var oDoc = oIframe.contentWindow || oIframe.contentDocument;
                      if (oDoc.document) {
                          oDoc = oDoc.document;
                      oDoc.parent.login.logonForm.f_username.value = 'xxxl@quer.co.uk';
                      oDoc.parent.login.logonForm.f_passwd.value = 'zzz';
                      return true; 

              <input type="button" value="my javascript" onclick="javascript:paybutton()" style="float:left;" />