PDA

View Full Version : probably a simple solution




ldenman
Apr 25, 2006, 10:10 PM
i am creating a web app. I need to know how to take text the user inputs (specifically an image url) and put that url in the <img src=""> tags.
does anyone know how this would be accomplished?

edit: i guess this should be in the web forum. my bad.
I am using RoR though, so it sorta counts.



freiheit
Apr 26, 2006, 12:48 AM
i am creating a web app. I need to know how to take text the user inputs (specifically an image url) and put that url in the <img src=""> tags.
does anyone know how this would be accomplished?

edit: i guess this should be in the web forum. my bad.
I am using RoR though, so it sorta counts.

It depends entirely on what language you are using for your web app. Are you using Perl? PHP? Python? ASP? JavaScript? When you say RoR I have a feeling you mean Ruby On Rails but I'm not certain.

ldenman
Apr 26, 2006, 01:18 AM
Ruby on Rails is what i'm using.

ldenman
Apr 26, 2006, 09:35 PM
anyone?

angelneo
Apr 26, 2006, 10:28 PM
Can I assume that this is javascript? It makes more sense if it is.

Let's just say a person clicks on a button (onClick, onChange, onBlur so on) and as long as you have the id to your img tag and input tag, just do the following:

document.getElementById('image_tag_id').src = document.getElementById('input_text_id').value

or you can

document.getElementById('image_tag_id').setAttribute('src', document.getElementById('input_text_id').value)