The alert is showing, but the value is not changing…. why?
<html>
<head>
<title>Test EuDock</title>
</head>
<body >
<label id="labelID">test</label>
<script type="text/javascript" >
document.onkeyup = KeyCheck;
function KeyCheck(e) {
var KeyID = (window.event) ? event.keyCode : e.keyCode;
switch(KeyID)
{
case 39: // right arrow
document.getElementById('labelID').value="BLZ";
alert('ok');
break;
}
}
</script>
</body>
</html>
Only
inputelements have the propertyvalue. You wantinnerHTML:innerHTMLis the only attribute that is supported by all browsers.innerTextis not supported by Firefox andtextContentis not supported by <= IE8.