title: Mozilla gets strange value in WebForm_DoPostBackWithOptions JavaScript function
body: <ol>
  <li>Where does the variable <code>options.eventTarget</code> come from?</li>
  <li>How can I fix this function for Mozilla if it's generated by ASP.NET code?</li>
  <li>What is this JavaScript function used for?</li>
  </ol>
  
  <p>Mozilla Firefox gets this value for <code>options.eventTarget</code> at the end of this function when the anchor tag is called.  The Save (anchor tag) button doesn't work in Mozilla, so I'm trying to figure out why.</p>
  
  <pre><code>ExplorerPageHtmlLeft$ct...aveCancelDelete$LBuSave &lt;===== problem
  </code></pre>
  
  <p>Internet Explorer gets this value for <code>options.eventTarget</code> at the end of this function when the anchor tag is called.  The Save (anchor tag) button works fine in Internet Explorer.</p>
  
  <pre><code>ExplorerPageHtmlLeft$ctl02$ctl00$SaveCancelDelete$LBuSave
  </code></pre>
  
  <h1>Here is the code spread out so it's easy to read</h1>
  
  <hr>
  
  <h2>Mozilla Firefox Save button (broken):</h2>
  
  <pre><code>&lt;a
  id="ExplorerPageHtmlLeft_ctl02_ctl00_SaveCancelDelete_LBuSave"
  href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ExplorerPageHtmlLeft$ctl02$ctl00$SaveCancelDelete$LBuSave", "", true, "", "", false, true))"
  onclick="javascript:encryptField(document.getElementById('ExplorerPageHtmlLeft_ctl02_ctl00_SaveCancelDelete_TxtPassword'),document.getElementById('IHHidden'));"
  &gt;
  &lt;img border="0" alt="Save" src="/images/save.gif"&gt;
  &lt;/a&gt;
  </code></pre>
  
  <hr>
  
  <h2>Internet Explorer Save button (works fine):</h2>
  
  <pre><code>&lt;a
  onclick="javascript:encryptField(document.getElementById('ExplorerPageHtmlLeft_ctl02_ctl00_SaveCancelDelete_TxtPassword'),document.getElementById('IHHidden'));"
  id="ExplorerPageHtmlLeft_ctl02_ctl00_SaveCancelDelete_LBuSave"
  href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&amp;quot;ExplorerPageHtmlLeft$ctl02$ctl00$SaveCancelDelete$LBuSave&amp;quot;, &amp;quot;&amp;quot;, true, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, false, true))"
  &gt;
  &lt;img src="/images/save.gif" border="0" alt="Save"&gt;
  &lt;/a&gt;
  </code></pre>
  
  <hr>
  
  <h1>Here is the JavaScript function:</h1>
  
  <pre><code>function WebForm_DoPostBackWithOptions(options) {
      var validationResult = true;
      if (options.validation) {
          if (typeof(Page_ClientValidate) == 'function') {
              validationResult = Page_ClientValidate(options.validationGroup);
          }
      }
      if (validationResult) {
          if ((typeof(options.actionUrl) != "undefined") &amp;&amp; (options.actionUrl != null) &amp;&amp; (options.actionUrl.length &gt; 0)) {
              theForm.action = options.actionUrl;
          }
          if (options.trackFocus) {
              var lastFocus = theForm.elements["__LASTFOCUS"];
              if ((typeof(lastFocus) != "undefined") &amp;&amp; (lastFocus != null)) {
                  if (typeof(document.activeElement) == "undefined") {
                      lastFocus.value = options.eventTarget;
                  }
                  else {
                      var active = document.activeElement;
                      if ((typeof(active) != "undefined") &amp;&amp; (active != null)) {
                          if ((typeof(active.id) != "undefined") &amp;&amp; (active.id != null) &amp;&amp; (active.id.length &gt; 0)) {
                              lastFocus.value = active.id;
                          }
                          else if (typeof(active.name) != "undefined") {
                              lastFocus.value = active.name;
                          }
                      }
                  }
              }
          }
      }
      if (options.clientSubmit) {
          __doPostBack(**options.eventTarget**, options.eventArgument);
      }
  }
  </code></pre>