PDA

View Full Version : need help in code ?


keissfootball
07-12-2006, 04:38 PM
hello. I want to make something like in this forum - the bbcode as I think it is called. the idea is, when I press on a button or an image, it inserts for example <br /> in the textarea. Tried to do it with js, but it didn't work. What am I doing wrong?


<html>
<head>
<title>123</title>
</head>
<body>
<SCRIPT language="JavaScript" type="text/javascript">
<!--
function settext(which){
document.newmessage.message.value = document.newmessage.message.value + which;
}
//-->
</SCRIPT>

<textarea name="message" cols="35" rows="5"></textarea>

<A HREF="javascript:settext('<br /> ')" ONFOCUS="filter:blur()"><img src="sm07.gif" width="17" height="17" title="<br />" border="0"></a>
</body>
</html>

mic2100
07-12-2006, 04:44 PM
You could try this


<html>
<head>
<title>123</title>
</head>
<body>
<SCRIPT language="JavaScript" type="text/javascript">
<!--
function settext(which){
document.newmessage.message.value = document.newmessage.message.value + which;
}
//-->
</SCRIPT>
<form name="newmessage">
<textarea name="message" cols="35" rows="5"></textarea>
</form>
<A HREF="javascript:settext('<br /> ')" ONFOCUS="filter:blur()"><img src="sm07.gif" width="17" height="17" title="<br />" border="0"></a>
</body>
</html>


i think that you have left the form outta ur code which results in ur javascript lookin 4 it inthe wrong place.

keissfootball
07-12-2006, 04:49 PM
oh yes, my fault, tnx ;)

mic2100
07-12-2006, 04:50 PM
no probs :thumbsup:

keissfootball
07-12-2006, 06:19 PM
oh yes, and another thing. how can I know which text part to to put in <b></b> tags? something with selection start and selection end, but I didn't find anything usefull on the internet...