P
pra__
Hi,
I am developing a WYSIWYG editor using JS. I want to put in 4 spaces,
when a 'tab' key is pressed. I have this code, which does not work,
can anyone explain me about this.
<html>
<head>
<script>
function chk(e){
if (e.keyCode==9){
c = document.getElementById('code');
d = c.value ;
d = d + "\t";
// d = d+" " ;
c.innerHTML = d ;
//alert (d);
}
}
</script>
</head>
<body>
<textarea id="code" onkeydown="chk(event)" rows=20 cols=60></textarea>
</body>
</html>
I am developing a WYSIWYG editor using JS. I want to put in 4 spaces,
when a 'tab' key is pressed. I have this code, which does not work,
can anyone explain me about this.
<html>
<head>
<script>
function chk(e){
if (e.keyCode==9){
c = document.getElementById('code');
d = c.value ;
d = d + "\t";
// d = d+" " ;
c.innerHTML = d ;
//alert (d);
}
}
</script>
</head>
<body>
<textarea id="code" onkeydown="chk(event)" rows=20 cols=60></textarea>
</body>
</html>