Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2004
    Location
    Illinois
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript Question

    Hey everyone the question I have is I am creating my own message board and I want to be able to click on a smiley face and have it automatically inserted into my message body, but I don't want to limit it to just smileys. I would like to be able to do it for any graphic I have in the directory. I was able to get PHP to create an array of these images and display them but I can't figure out the javascript to get it to insert them when clicked on.

    Any help would be great.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,919
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    JavaScript cannot do this - you need a server-side language (such as PHP).

  • #3
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    correction, JS _can_ do this... unless I misinterpreted what you mean then Phillip M would be right.
    you want a popup window where you click on a smilie and it will insert the smilie text, e.g., :smilie:?

  • #4
    New to the CF scene
    Join Date
    Dec 2004
    Location
    Illinois
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    basically we have a message board and I want to list a bunch of graphic in a table or something similar and then have the ability to click on the image you want and have it automatically inserted into the post you are writing. Our current system does this and I believe it is through javascript but I am having trouble recreating it. The current system is in asp and it is old and hard to update and always breaks so were are rewriting everything in php.

    here is the old code:
    <img src="<%=strPath & objItem.Name%>" onClick="javascript:document.forms.MessageForm.Body.value = document.forms.MessageForm.Body.value + ' <img src=<%=strPath & objItem.Name%>> '">

    This code works


    New code:
    <img src="images/Smileys/{$smileys[i]}" onClick="javascript:document.new.body.value = document.new.body.value + '{$smileys[i]}'">

    This new code is in a loop the smiley doesn't have the path to it yet but it isn't inserting anything for some reason.

    I was just wondering if anyone could see something i am doing wrong or knows of another way to do this. the old site doesn't have a pop up window for you to click on the image they just show up below the text box.


  •  

    Posting Permissions

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