Javascript Form Submit Failure
<p>I have code on my website that isn't working, and I haven't been able to figure out why...</p>

<p>Here is the code:</p>

<pre><code>if (self.location.href == top.location.href) {
     document.fastform.submit();
 document.getElementById(fastform).submit();
}
</code></pre>

<p>Now if I put something other than a form submit into the if statement, it works just fine.  It's just when I do the form submit code it never works...</p>

<p>Here is the form code:</p>

<pre><code>&lt;form id="fastform" name="fastform" ACTION="/amember.php"&gt;
&lt;INPUT TYPE="text" NAME="myurl" ID="myurl"&gt;
&lt;input type="submit" /&gt; 
&lt;/form&gt; 
</code></pre>

<p>Thanks for the help guys!</p>

<p>So far none of the suggestions work, I have tried several different variations like putting quotes around the fastform in getelementbyid.  Here is my entire javascript program:</p>

<pre><code>&lt;script type="text/javascript"&gt;

function geturl() {
var locate = document.location
document.fastform.myurl.value = locate
}
window.onload = geturl; 

if (self.location.href == top.location.href) {
var f=document.forms.fastform; f.submit();
}

&lt;/script&gt;
</code></pre>

<p>Thanks for the suggestions!</p>

<p>Okay, so using some of the suggested code here I got it working.  The problem was the if statement was not being executed at the right time, I moved things around so that the if statement was executed LAST and everything started working.  Here is the complete (functioning) code:</p>

<pre><code>&lt;script type="text/javascript"&gt;

function geturl() {
var locate = document.location
document.fastform.myurl.value = locate
getmeoutofhere()
}
window.onload = geturl;

function getmeoutofhere() {
   if (self.location.href == top.location.href) {
   document.getElementById('fastform').submit();
   }
}
&lt;/script&gt;
&lt;form id="fastform" name="fastform" ACTION="/amember.php" style="visibility:hidden;"&gt;
&lt;INPUT  TYPE="text" NAME="myurl" ID="myurl" /&gt;
&lt;input type="submit" /&gt; 
&lt;/form&gt; 
</code></pre>
