Auto submit the user registration form I am customizing the user registration in the template file. I want to auto submit the registration form using Drupal code, or JavaScript code. 

Does anyone know how I should achieve this?
Based on your question, I would recommend you use the devel module to auto-generate random users.

OR if you really want to auto-submit the user form (or any form) then attach JavaScript to the page that does so via #attached in a hook_form_alter or via drupal_add_js() or simply in your theme via a .js file included in your .info file.

The javascript would be as Eugene Fidelin has posted above – $('#user-register-form').submit();or potentially by extending the Drupal.behaviors object, which is recommended for a number of reasons I won't get into here:

(function ($) {

  Drupal.behaviors.myModule = {
    attach: function (context) {
      $('#user-register-form').submit();
    }
  };

})(jQuery);