If a html page contains what likes:
<
table
>
< tr >
< td >
Enter Key Here ->
< input type ="text" id ="key" name ="key"
onkeyup ="convertToDecimal( );" >
</ td >
</ tr >
</ table >
< br />
< table >
< tr >
< td colspan ="5" style ="border-bottom:solid black 1px;" >
Key Pressed:
< input type ="text" readonly id ="keypressed" >
</ td >
</ tr >
</tabl
< tr >
< td >
Enter Key Here ->
< input type ="text" id ="key" name ="key"
onkeyup ="convertToDecimal( );" >
</ td >
</ tr >
</ table >
< br />
< table >
< tr >
< td colspan ="5" style ="border-bottom:solid black 1px;" >
Key Pressed:
< input type ="text" readonly id ="keypressed" >
</ td >
</ tr >
</tabl
We can get keys using getElementById( keyId ),
var key = document.getElementById("key");
var keypressed = document.getElementById("keypressed");
And we can put the value of key into the value of keypressed like this:
keypressed.value = key.value;
So we can get the value of a <input> control by:
myvalue = document.getElementById("keyId").value;