title: Add an "onclick" attribute to login submit button in Drupal 7
body: <p>I have a drupal proyect inside another page as an <code>iframe</code> and I want to add an attribute to the login submit button that redirect the top url to an custom url like this:</p>
  
  <pre><code>top.location.href = 'somepage.html';
  </code></pre>
  
  <p>I'm trying this:</p>
  
  <pre><code>  function hook_form_alter(&amp;$form, &amp;$form_state, $form_id){
      if($form_id == 'user_login_block'){
        $form['actions']['submit']['#attributes'] = array('onclick' =&gt; "top.location.href = 'somepage.html';");
      }
    }
  </code></pre>
  
  <p>I'm sure that the <code>$form_id</code> is <code>user_login_form</code>, but nothing happened.</p>