Click to See Complete Forum and Search --> : jump box help
wgbcworship
10-22-2003, 12:27 PM
Can somebody help me out here?
I need to have a text box on my site where a person would enter a filename without the extention, click a submit button and have the page jump to that file.
A section of my site will be filled with people's pictures. Each person will have a pre-assigned code. When the pictures are uploaded to the site the filename will correspond to the code each person was given. I'm sure there is a way to use a modified jump box to accomplish this. For example, in the box a person would type his code, smith0212, click a submit button, and the script would display the picture with the filename img/hc/smith0212.jpg.
I think I have explained this well-enough, if not just ask. Can anyone help me out?
<input type="text" name="img_txt" onchange="document.images['usrImg'].src=this.value;">
<img src="user_image.gif" alt="User Image" name="usrImg">
[J]ona
wgbcworship
10-22-2003, 03:24 PM
Thanks for the prompt help. What variables do I need to add or change to make it work in my document? I tried it but I could get an image change. I assume that I've missed something.
I've never tried to do that, it was just a guess. It may not be possible to use an INPUT TYPE="IMAGE" and change its SRC like a rollover, although I'd imagine it'd behave exactly like an image. You could use a normal image and then onclick="this.form.submit();"
[J]ona
wgbcworship
10-22-2003, 03:48 PM
OK, I seems to me like we're trying to change an image on the screen, and that might not work. We don't necessarily need to do that. It's OK to display it as it's own page, maybe by using a window.document (?) call. Either way, I think the event handler should be onClick with the submit button (only so that it is deliberate).
Then I have misunderstood the original question. I just did some testing, and it turns out that you can update the SRC of an INPUT TYPE="image" tag, so obviously the problem is not there, because the code I posted should have worked fine.
[J]ona
wgbcworship
10-22-2003, 04:34 PM
I didn't intend to say your solution was wrong. You simply mentioned it might not work. The only thing I know about javascript is what I've picked up from C&Ping, so you'll have to treat me like a newbie. If we can do it this way, that would be great. I think it would looks much better.
You've used the term input type="image" twice, yet I don't see that syntax in the original code. Perhaps I am just misunderstanding something. If you tested the code and it worked, can you tell me what you named the img you called and what you typed in the text box? If it works for you, I'm obviously the problem. Nothing new. :)
<input type="image" src="submit_off.gif" onmouseover="this.src='submit_on.gif';" onmouseout="this.src='submit_off.gif';" alt="Submit">
[J]ona
wgbcworship
10-22-2003, 04:57 PM
ok, I'm lost. Is this in place of the previous code? In addition to? I don't see any text input?
I need to be able to type a code such as smith0212 in the text box and have it return the proper image. A different person would use his code (maybe jones0311) to return his image.
<form action="" onsubmit="return false;"><div>
Username: <input type="text" name="imgTxt"><br>
<button onclick="document.images['tImg'].src=this.form.imgTxt.value;">Show Image</button><br><br>
<img src="nothing.gif" alt="User image">
</div></form>
[J]ona