topical media & game development

talk show tell print

professional-ajax-02-Hidden-IFrame-Examples-HiddenIFrameExample3.htm / htm

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      <title>Hidden IFrame Example 3</title>
      <script type="text/javascript">
          var oIFrame = null;
          function createIFrame() {
              var oIFrameElement = document.createElement("iframe");
     = "hiddenFrame";
     = "hiddenFrame";
              oIFrame = frames["hiddenFrame"];
          function checkIFrame() {
              if (!oIFrame) {
              setTimeout(function () {
                  oIFrame.location = "ProxyForm.htm";
              }, 10);                              
          function formReady() {
              var oHiddenForm = oIFrame.document.forms[0];
              var oForm = document.forms[0];
              for (var i=0 ; i < oForm.elements.length; i++) {
                  var oHidden = oIFrame.document.createElement("input");
                  oHidden.type = "hidden";
         = oForm.elements[i].name;
                  oHidden.value = oForm.elements[i].value;
              oHiddenForm.action = oForm.action;
          function saveResult(sMessage) {
              var divStatus = document.getElementById("divStatus");
              divStatus.innerHTML = "Request completed: " + sMessage;            
      <form method="post" action=<SaveCustomer.php> onsubmit="checkIFrame(); return false">
      <p>Enter customer information to be saved:</p>
      <p>Customer Name: <input type="text" name="txtName" value="" /><br />
      Address: <input type="text" name="txtAddress" value="" /><br />
      City: <input type="text" name="txtCity" value="" /><br />
      State: <input type="text" name="txtState" value="" /><br />
      Zip Code: <input type="text" name="txtZipCode" value="" /><br />
      Phone: <input type="text" name="txtPhone" value="" /><br />
      E-mail: <input type="text" name="txtEmail" value="" /></p>
      <p><input type="submit" value="Save Customer Info" /></p>
      <div id="divStatus"></div>

(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.