var isPressed =0;
document.body.onkeypress = function(evt)
{
evt = evt || window.event;
if (evt.keyCode!=='undefined') {
// Do your stuff here
isPressed = 1;
console.log(isPressed);//Here it gives 1
}
//return isPressed;
}
result = navigator.appVersion +"|"+n+"|"+getStyle(mydiv,'opacity')+"|"+history.length+"|"+metarefesh+"|"+hasFocus+"|"+navigator.platform+"|"+parent.top.document.referrer+"|"+activexenable+"|"+javaEnabled+"|"+hasFlash+"|"+navigator.plugins.length+"|"+ hasMouseMoved+"|"+isClicked +"|"+**isPressed**+"|"+isresized+"|"+isScrolled+"|"+getStyle(mydiv,'zIndex');
console.log(result); console.log(isPressed)//This gives out zero even though I have pressed a key and it has changed to 1.
If I do a console.log(isPressed) inside the if loop in question it works.Its a scoping issue I am not aware of.Please help.
Thanks in advance