Get image based on user input

S

SPEAKIT

I'm sorry to ask what must be a very simple question, but I just can't seem
to get this to work.
Right now I am using the javascript 'prompt' to enter a photoid and the
script that I am using uses document.write
to put the proper image on the page ....i.e. PHOTOID =".jpg"

What I want is a simple user input text area and when submit is clicked a
placeholder image beneath is exchanged for the proper
image based on the user's input.
example: User enters re4555 and the image re4555.jpg replaces the image
nosel.jpg
that I have created which basically says 'no image selected'.

please,please help, this is very frustrating.
Thank you
(e-mail address removed)
 
L

Lee

SPEAKIT said:
I'm sorry to ask what must be a very simple question, but I just can't seem
to get this to work.
Right now I am using the javascript 'prompt' to enter a photoid and the
script that I am using uses document.write
to put the proper image on the page ....i.e. PHOTOID =".jpg"

What I want is a simple user input text area and when submit is clicked a
placeholder image beneath is exchanged for the proper
image based on the user's input.
example: User enters re4555 and the image re4555.jpg replaces the image
nosel.jpg
that I have created which basically says 'no image selected'.

Is there a reason why you want to use document.write()?
Am I correct that you are not actually submitting a form?
It would probably be easier and more helpful to correct your
code than to show you new code.
 
S

SPEAKIT

here is an example of something that doesn't work.....lol

<html>
<head><title>FormImage Test</title>
<script>
var selimage = NewImage();
selimage.src = "nosel.jpg"
function dothisnow(){
var picid = document.getElementById("picid").value;
selimage.src = picid +".jpg";
}
</script>
</head>
<body>
<form>
<p align="center">
Please Enter your Photo ID:<br>
<input type=text id="picid" name="picid">
<input type=button value="Click Here to See Your Photo" name="clicker"
id="clicker" onClick=dothisnow
();>
<p align="center"><img src="nosel.jpg" name="selimage" id="selimage">
</form>
</body>
</html>
--sorry for being an idiot.....
 
S

SPEAKIT

You are the best!!!!!!!
It works exactly as I needed!!!!!
I customized a little and voila all up and running!!!

Thank YOU thankyou THANK you THANKYOU!!!

oh.....and I learned a lot too.......
about syntax and the proper way to call an elementbyid and such.....

thank you so much

sd
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top