I have an odd problem, and I really can’t see where I’m going wrong with this. I have a page with a form on it called “entryform”. This form has a hidden field called “imagefile” and a button beside it called “Choose Image”. There is also an <img> tag called “showimage” which displays the currently selected image.
The “Choose Image” button opens a new window with a list of images. Each image has a SELECT link beside it. The code for the SELECT link looks like this:
[code]<a href=”#” onClick=”window.opener.document.showimage.src=’images/ninestein.jpg’;window.opener.document.entryform.imagefile.value=’1′;”>SELECT</a><br>
On clicking the select link, the src attribute of “showimage” is correctly changed to the chosen image (in this case images/ninestein.jpg), and the picture changes back in the original window. However, the value in the hidden “imagefile” input tag doesn’t change. This is supposed to change to reflect the database number of the selected image (in this case, ‘1’).
I can verify this by changing “imagefile” from a hidden to a text field. The of “imagefile” never changes. I’m at my wit’s end, I can’t figure out what’s wrong with my code. I’m a bit of a JS newbie, but this seems simple enough. Any thoughts, anyone?