Hi,
I need to capture Enter key (keyCode==13) in an designMode enabled iframe of my chat sending virtual textbox. it's a wysiwyg posting. However I have the following code working fine in IE7 but not working in FireFox.
Can Anybody please tell me how can I reffer to the keyCode in firefox in this example:
I need to capture Enter key (keyCode==13) in an designMode enabled iframe of my chat sending virtual textbox. it's a wysiwyg posting. However I have the following code working fine in IE7 but not working in FireFox.
Can Anybody please tell me how can I reffer to the keyCode in firefox in this example:
Code:
<body onLoad= Starta()>
<script>
function Starta() {
iF=document.getElementById('rtoIFrame0').contentWindow.document;
iF.onkeypress = cK;
return true;
}
function cK(event) {
if (document.getElementById('rtoIFrame0').contentWindow.event.keyCode){
k = document.getElementById('rtoIFrame0').contentWindow.event.keyCode; // Works on IE
}
else if (document.getElementById('rtoIFrame0').contentWindow.e.which){
k = document.getElementById('rtoIFrame0').contentWindow.e.which; // dos not Work on FireFox
}
if(k==13){
alert(k);
return false;
}
return true;
}
</script>
<iframe id=rtoIFrame0></iframe>
Comment