Jump to content

[SOLVED] Not sure what to call the subject :p


AV1611

Recommended Posts

1st, I know PHP and NOT JS!  :P

 

I have a shoutbox I wrote in php. It works great. when the user does : P for example they get :P .

 

The bottom of the box is a textarea

 

Below the shoutbox is a table with every smiley and code in a td cell.

 

Now, the question.

 

I want to make it so if you click a smily image below it shows up in the textarea above.

 

No clue where to begin, but I 've seen similar before.

 

Help, and be gentle :)

<form method="POST">

<textarea></textarea>

<input type="submit" value="Shout!" />

</form>

 

then at the bottom a simple table with

 

<td><img.... /> :somecode: </td>

and so on.

 

The code and image are simple replace when the text is displayed. all posts are in database table, and all img name/code are in a table.

 

that's it.

 

<script type="text/javascript">
function insertSmiley(smiley){
  var txtarea = document.getElementById('smileytext');
  txtarea.value = txtarea.value+smiley;
}
</script> <!-- just modified this, sorry -->
<form method="POST">
<textarea id="smileytext"></textarea>
<input type="submit" value="Shout!" />
</form>

then at the bottom a simple table with

<td><img onclick="insertSmiley('');".... /> :somecode: </td>

 

Try that, modifying it, of course.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.