element.onkeypress = function(e) {
if(e.keyCode) {
element.keyCode = e.keyCode;
} else {
element.keyCode = e.charCode;
}
};
Also in java script , there is also
<input onChange="a(event)"/>
<script>
function a(event) {
alert(event.target.value);
}
</script>
As a parameter receiving, how do I know if I must put event for parameter instead of e? Second example wont work if it's the parameter is anything other than event aren't both javascript?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…