开发者

how to Perform Backspace operation in TextBox using KeyCode '8' in C# asp.net.?

I am developing Macro application in C# asp.net , for that i ne开发者_如何学Goed to keep track of all the key that i had pressed from keyboard. here i found that the KeyCode for "Backspce" is 8. but when i used String.fromCharCode(8), it gives specialCharcter('square box') insted performing Backspace operation. This problem is also same for other Special Character like Up,Down,Left,Right arrow keys,Delete key,etc. (note : here i had use JavaScript for getting Character's KeyCode.. )

Thank You in Advance....


You'll have to adjust it's value:

HTML:

<input type="text" name="whatever" id="theInput" />
<button id="delete">Backspace</button>

Javascript:

document.getElementById('delete').addEventListener('click', function()
{
    var theInput = document.getElementById('theInput');
    theInput.value = theInput.value.substr(0, theInput.value.length - 1);
});

Here's the fiddle: http://jsfiddle.net/jwQbh/1/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜