function CheckEnterKey(e,obj) { //e is event object passed from the function var characterCode //literal character code will be stored in this variable if(e && e.which){ //if which property of event object is supported (NN4) e = e characterCode = e.which //character code is contained in NN4's which property } else{ e = event characterCode = e.keyCode //character code is contained in IE's keyCode property } if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key) CheckSearch(obj);// document.forms[0].submit() //submit the form return false } else{ return true } } function CheckSearch(objText) { if(objText.value.length < 4 ) { alert("Search text must be 4 characters at least"); return false; } else if(objText.value.toLowerCase()=='Search'.toLowerCase()) { alert("Please enter a Keyword"); } else { var strUrl=window.location.href; if( strUrl.indexOf('htm')!=-1) { intIndex=strUrl.indexOf('.htm')-2; var strlang = strUrl.substr(intIndex,2); window.location ="/UserPages/user_search.aspx?publish=yes&keywords=" + objText.value + "&keyword=" + objText.value + "&lang=" + strlang; } else if(strUrl.indexOf('publish=yes')!=-1) window.location ="/UserPages/user_search.aspx?publish=yes&keywords=" + objText.value + "&keyword=" + objText.value; else window.location ="/UserPages/user_search.aspx?keywords=" + objText.value + "&keyword=" + objText.value; } }