I'm trying to make a webpage do the following:
I want a user to be able to click on a given image (there will be more than
one image). Upon clicking a given image, characters specific to that image
will be inserted into a textbox which is actually a text area. If the
cursor is in the textbox/textarea then the characters are to be inserted at
the cursor location. This means if the cursor is between some text then the
characters need to be inserted in between the text exactly where the cursor
is. If the cursor is not in the textbox/textarea then the characters need
to be displayed at the end of any text or at the start if there is no text
present. Keep in mind the characters to be inserted will be unique to a
given image. There will be only one textbox/textarea on the pages I'm
wanting to do this on.
I know a bit about Javascript but am far from an expert. I found a webpage
that does this and copied the code from it. Can't get it working though.
I'm getting a java error as a matter of fact. No idea why. Does anyone
have a link handy I can go to see a simple example of this without a large
amount of stuff on the webpage so I can easily extract the code? The
webpage I found, when I save the source file, is huge and it's hard to pick
the code out of it although I thought I correctly got it all. Or, perhaps
someone can post the code in a response to this message aloing with some
short HTML as an example? Thanks!
Chris Smith
I want a user to be able to click on a given image (there will be more than
one image). Upon clicking a given image, characters specific to that image
will be inserted into a textbox which is actually a text area. If the
cursor is in the textbox/textarea then the characters are to be inserted at
the cursor location. This means if the cursor is between some text then the
characters need to be inserted in between the text exactly where the cursor
is. If the cursor is not in the textbox/textarea then the characters need
to be displayed at the end of any text or at the start if there is no text
present. Keep in mind the characters to be inserted will be unique to a
given image. There will be only one textbox/textarea on the pages I'm
wanting to do this on.
I know a bit about Javascript but am far from an expert. I found a webpage
that does this and copied the code from it. Can't get it working though.
I'm getting a java error as a matter of fact. No idea why. Does anyone
have a link handy I can go to see a simple example of this without a large
amount of stuff on the webpage so I can easily extract the code? The
webpage I found, when I save the source file, is huge and it's hard to pick
the code out of it although I thought I correctly got it all. Or, perhaps
someone can post the code in a response to this message aloing with some
short HTML as an example? Thanks!
Chris Smith
Comment