<body id="body" runat="server" onkeydown="return showKeyCode(event)">
Now whenever I hit a key, IE8 (or in comp mode) throws an exception directing to a problem in line x, which happens to be my body tag. How can I prevent that ? The JS code to my knowledge should be with IE comp. (works in Chrome) Moreover the code doesn't work in IE and Firefox (it doesn't block F5 and Enter)
--> Object expected
var version = navigator.appVersion;
function showKeyCode(e) {
var keycode = (window.event) ? event.keyCode : e.keyCode;
if ((version.indexOf('MSIE') != -1)) {
if (keycode == 13) {
event.keyCode = 0;
event.returnValue = false;
return false;
}
}
else {
if (keycode == 13) {
return false;
}
}
}
Another problem I'm facing is with this simple JS in IE & FF (works in Chrome):
Nothing happens & --> Object expected
<a onclick="ClearTextboxes();" title="Close" id="close" runat="server">Close</a>
....in script tags:
function ClearTextboxes() {
document.getElementById('<%= txtbox_name.ClientID %>').value = '';
document.getElementById('<%= txtbox_email.ClientID %>').value = '';
document.getElementById('<%= txtbox_content.ClientID %>').value = '';
document.getElementById('<%= ResultMail.ClientID %>').style.display = 'none';
}