Help with hiding the submit button

Help with hiding the submit button

I have a script that hides the 'submit to cart' button until all the required fields have been filled out.

Does anyone have any idea why it won't work in IE7/IE8 but it does work in Firefox?

The script:
  1. <script type="text/javascript" language="javascript">
  2. function checkform(){
  3. var f = document.forms["myform"].elements;
  4. var cansubmit=true;
  5. for (var i = 0; i < f.length; i++) {
  6. if (f[i].value.length==0) cansubmit=false;}
  7. if (cansubmit){document.getElementById('submitbutton').disabled=false;
  8. }}
  9. </script>
The form:
  1. <form id="myform" method="post" action"">
  2. <input class="txt_input input" name="First-Name" onkeyup="checkform()" type="text">
  3. <input class="txt_input input" name="Last-Name" onkeyup="checkform()" type="text">
  4. <input id="submitbutton" type="submit" disabled="disabled" name="submit" value="Add to Cart" class="foxycart foxbutton" />
  5. </form>
Any help would be greatly appriciated!