PDA

View Full Version : Displaying images in a textbox



d-machine
09-17-2008, 09:55 PM
I

I am not sure, there is a need to use Javascript here, however I want to display images in a input text box, like simple Rich text editor.

Does anyone here have any idea?

THANKS :)

magicyte
09-17-2008, 10:36 PM
Yes. I suppose you understand a tid-bit of CSS, so just bear with me if you don't.

What you wish to do here is put an image in a textbox, correct? If so, that is impossible... However, you may put an image on a textbox. Simple CSS can solve this. In your image tag where the style attribute is, make the position of the images absolute. Here is the code for doing so:

position:absolute;

Now, once you have that, place where you wish to place the image. Here is some code to show you, in pixels from the top or left, where it will go, obviously placed ABOVE the textbox:

top:however_many_pixels_here(integer);
left:however_many_pixels_here(integer);

Now, the final bit of code:

z-index:100;

All you have to do is paste this code in your style attribute in the img tag. Feel free to tamper with the 2nd and 3rd bits of code.

Hope I helped.

-magicyte

rangana
09-18-2008, 12:53 AM
You can make an image as background of the textbox. Use CSS' background property:


<input type="text" style="background:url('image.jpg') center center no-repeat;">


Hope that makes sense.

d-machine
09-18-2008, 10:04 AM
I'll try this,
thank you very much!

magicyte
09-18-2008, 04:17 PM
That too :).

-magicyte