0

The code below

I have a problem... When you hit enter on a text field firefox stays at the same page because I have returned false; (I assume) but IE still submits the form normally.

What am I doing wrong?

window.onload = function() {
  var form = document.getElementById('keyword');
  var inputbox = document.getElementById('searchType');
  inputbox.onkeyup = function(e) {
    e = e || window.event;
    keycode = e.keyCode || e.which;
    if (keycode == 13) {
    	ajaxGet(form,'index.html'); //submit form AJAX
	return false; //supposedly to stop browser from submitting
    }else if(this.value.length > 2){
	showHint(this.value);
    	return;
}else{
       //return everything to normal
	var query = document.location.hash.replace('#','');
	query = query.replace(':q:','?');
	breadCrumbs(query);
	return;
	}
  }
};
1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by jrdark13
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.