P
pra__
Hi, i am designing a WYSIWYG editor. I want that when the user presses
a 'TAB', a count of four spaces should be put. I used this code,
<html>
<head>
<script>
function chk(e){
if (e.keyCode==9){
c = document.getElementById('code');
d = c.value ;
d = d + " ";
c.value = d ;
c.focus();
}
}
</script>
</head>
<body>
<textarea id="code" onkeydown="chk(event)" rows=20 cols=60></textarea>
</body>
</html>
However, the focus issue is that, when the user presses the 'TAB',
then the focus goes to the address bar. How should i avoid it ?
a 'TAB', a count of four spaces should be put. I used this code,
<html>
<head>
<script>
function chk(e){
if (e.keyCode==9){
c = document.getElementById('code');
d = c.value ;
d = d + " ";
c.value = d ;
c.focus();
}
}
</script>
</head>
<body>
<textarea id="code" onkeydown="chk(event)" rows=20 cols=60></textarea>
</body>
</html>
However, the focus issue is that, when the user presses the 'TAB',
then the focus goes to the address bar. How should i avoid it ?