I have this code:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {

    $('div[contenteditable]').keypress(function (e) {
    if(e.which == 13)
       document.location='http://www.' + $('div[contenteditable]').html() + '.com';

div[contenteditable] { background:white; font-size:42px; color:black;outline:none; border:none; }
<div contenteditable></div>
and I want to add several conditions like : only two words to be accepted, for example google and yahoo also if is nothing typed in and the return(enter) is pressed to appear a alert or something like this...