Hello everybody.
I've tried the following code in the head:
<script language="JavaScript">
var TxtArea = 0;
function insert_bui( t ){
if( !TxtArea ) return;
tx = document.selection.createRange( );
switch( t ){
case "B":
tx.text = "-b-" + tx.text + "-/b-" ;
break;
case "I":
tx.text = "-i-" + tx.text + "-/i-";
break;
case "U":
tx.text = "-u-" + tx.text + "-/u-";
break;
}
document.selection.empty( );
TxtArea = 0;
}
</script>
And I put the following code in the body:
<form name="TFrm" action="Send.php">
<input type="button" value="B" onclick="TFrm.TxtA.focus(); insert_bui('B');">
<input type="button" value="I" onclick="TFrm.TxtA.focus(); insert_bui('I');">
<input type="button" value="U" onclick="TFrm.TxtA.focus(); insert_bui('U');">
<input type="text" name="TxtA">
<input type="submit" value="Submit">
</form>
This code should enclose the selected characters in the TxtA field with the tags I specified in the function.
However, when I click on any button, it adds nothing!
Any help would be appreciated.