Archive

Archive for the ‘JavaScript’ Category

Call Button event in javascript

October 16, 2012 Leave a comment

function DoSearch() {
if (window.event.keyCode == 13) {
var btnSearch = document.getElementById(“”)
btnSearch.click();
window.event.cancel = true;
}
}

For Track which key was pressed

function doSomething(e) {
var code;
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code);
alert(‘Character was ‘ + character);
}

Advertisements
Categories: JavaScript