Call java function from php

Hi! How do I run this js function:

<script type="text/javascript">function invalidContact() {
    document.getElementById( 'contact' ).scrollIntoView();    
};
</script>

from here:

if(isset($_POST['submitted']))
{
   if($formproc->ProcessForm())
   {
       header("Location: http://websiteetc.html");
   }
else
{
invalidContact();
}
}

Its for a contact form if the fields return errors.I need it to scroll to the contact.

Thanks!