Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-25-2005, 05:16 PM   PM User | #1
mdzwolf
New to the CF scene

 
Join Date: Dec 2004
Location: Illinois
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
mdzwolf is an unknown quantity at this point
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.
mdzwolf is offline   Reply With Quote
Old 01-25-2005, 06:08 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,105
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
JavaScript cannot do this - you need a server-side language (such as PHP).
Philip M is offline   Reply With Quote
Old 01-25-2005, 06:12 PM   PM User | #3
fci
Senior Coder

 
Join Date: Aug 2004
Location: Twin Cities
Posts: 1,345
Thanks: 0
Thanked 0 Times in 0 Posts
fci is an unknown quantity at this point
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:?
fci is offline   Reply With Quote
Old 01-26-2005, 03:41 AM   PM User | #4
mdzwolf
New to the CF scene

 
Join Date: Dec 2004
Location: Illinois
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
mdzwolf is an unknown quantity at this point
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.
mdzwolf is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:43 AM.


Advertisement
Log in to turn off these ads.