Chat form

Results 1 to 2 of 2

Thread: Chat form

  1. #1
    Join Date
    Dec 1969

    Default Chat form

    I have a chat form with a message text field. In the same form I have a series of emotions. I would like to somehow replicate what MNS messenger offers and that is to click on the emotion to insert it into the main message area. I have been trying to insert onClick java scripts. Well anyway this is what I have so far:<BR><BR>txtMessage = Request.Form("message")<BR>txtMessage = trim(txtMessage)<BR>txtMessage = Replace(Server.HTMLEncode(txtMessage)," <BR>&#060;img src=moods/" &<BR>&#039; Here is where Im having problems. Im trying to perform so way<BR>&#039; of creating maybe a java script that will onClick insert a<BR>&#039; value at this point.<BR>& align=absmiddle&#062;") <BR><BR>I was assigning the image a value like (y) or :( and then writing out what the value = However I have over 50 emotions and it looks ugly. The original script looked like this: MESSY<BR><BR>txtMessage = Request.Form("message")<BR>txtMessage = trim(txtMessage)<BR>txtMessage = Replace(Server.HTMLEncode(txtMessage)," (y)", " &#060;img src=smilies/thumbs_up.gif align=absmiddle&#062;")<BR>txtMessage = Replace(txtMessage, " (n)", " &#060;img src=smilies/thumbs_down.gif align=absmiddle&#062;")<BR>txtMessage = Replace(txtMessage, " (b)", " &#060;img src=smilies/beer_yum.gif align=absmiddle&#062;")<BR>txtMessage = Replace(txtMessage, " (d)", " &#060;img src=smilies/martini_shaken.gif<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Chat form

    You can add the &#060;IMG..&#062; tag with an onClick event:<BR><BR>I assume you have a form with the smileys and a radiobutton next to every smiley to select the smiley you want. You need this two functions:<BR><BR>&#060;SCRIPT LANGUAGE="Javascript1.2"&#062;<BR>&#060;!--<BR>function getValue(){ <BR> for (var i=0;i&#060;;i++){<BR> if([i].checked){[i].value;}<BR> }<BR>}<BR><BR>//smile is the name of the form, smiley is the name of the radiobuttons<BR><BR>function insert_smiley(){ <BR>var img="&#060;IMG SRC=/img/smileys/"+value+".gif&#062;";<BR>var text=document.form1.txtbox.value;<BR>document.form 1.txtbox.value=text+" "+img;<BR>}<BR>//--&#062;<BR>&#060;/SCRIPT&#062;<BR><BR>Now add an button to the form with the smileys and call the insert_smiley function. <BR><BR>Add an onClick event to the radiobuttons that calls the getValue function.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts