Bry Man
09-19-2005, 12:20 AM
Hey
Ive been trying for days now to get a bbcode panel on my site for putting bbcodes and stuff into comment boxes since I have user inputted html striped from the comments, but so far ive had absolutely no luck. Ive tried several scripts but nothing seems to give any results. I just did a search on the Javascript forums here and tried a few of the 'working' scripts but they didnt work either. Here is the lastest one that i tried.
<html>
<head>
<script language="javascript">
var obj;
function insert(str){
if (obj){
obj.value+=str;
obj.focus();
}
}
</script>
</head>
<body>
<form name="">
<textarea name="t1" onfocus="obj=this"></textarea>
<textarea name="t2" onfocus="obj=this"></textarea>
<a href="javascript:insert(' :huh: ')">wee</a>
</form>
</body>
</html>
I have very little Js know how but Im aiming to learn, but this has me stumped...apparently it should work but it doesnt...could it be because im using FF...like i said, i dont know much about Js...if anyone can help me youd be saving me alot of frustration and I would greatly appreciate it, Ive got the php side of the bbcode script down, just the part where you click the link and the code is put into the text area is whats killing me =S
Ive been trying for days now to get a bbcode panel on my site for putting bbcodes and stuff into comment boxes since I have user inputted html striped from the comments, but so far ive had absolutely no luck. Ive tried several scripts but nothing seems to give any results. I just did a search on the Javascript forums here and tried a few of the 'working' scripts but they didnt work either. Here is the lastest one that i tried.
<html>
<head>
<script language="javascript">
var obj;
function insert(str){
if (obj){
obj.value+=str;
obj.focus();
}
}
</script>
</head>
<body>
<form name="">
<textarea name="t1" onfocus="obj=this"></textarea>
<textarea name="t2" onfocus="obj=this"></textarea>
<a href="javascript:insert(' :huh: ')">wee</a>
</form>
</body>
</html>
I have very little Js know how but Im aiming to learn, but this has me stumped...apparently it should work but it doesnt...could it be because im using FF...like i said, i dont know much about Js...if anyone can help me youd be saving me alot of frustration and I would greatly appreciate it, Ive got the php side of the bbcode script down, just the part where you click the link and the code is put into the text area is whats killing me =S