Why is my form not working? My error reads [closed]

  <!-- email starts -->
    <form name="myemailform" id="myemailform">
    
    <input type="email" id="myemail"placeholder="Enter E-mail Address">      
          
    <input type="email"id="myemailconfirm" placeholder="Confirm E-mail Address">
    
    
    
</form>
  <!-- email ends -->
    
    
    <script> 
    
function SameEmail(   ){

var myemailform=document.getElementById (" myemailform ");
 var myemail=document.getElementById ("myemail");
  

  
if(myemailform.myemail.value == 
   
myemailform.myemailconfirm.value)
    
{ 
alert("Emails are the same")
 
 myemailform.myemail.focus();
 
 
 
 
 
 } 
 
 }
 </script>

I’m looking to match the email addresses and validate if they are the same. It looks like everything is coded right, but I’m getting an error saying

“Cannot read properties of null (myemail).”

Thanks for the help!