Javasript and Forms...
Date: 11/18/07
(Javascript Community) Keywords: google
I'm trying to make an onClick pass a value to a hidden input field.
(Basically, you click image01, it passes image01 to the input field id="item01"
What I'd like to do is automate this process, so it can be written as:
var itemNum = src.substring(src.lastIndexOf('.'),src.length - 14);
document.getElementById('theForm').itemNum.value=itemNum;
My google-fu is failing me, and my JS isn't the best.
Any ideas?
BTW:
itemNum = the image name, so the image is 'whatever/image01_on.jpg' and returns 'image01_on'
That part works, but automating the process doesn't, so that each image will pass its own value to its own hidden value field.
Thanks as always, x-posted.
Source: http://community.livejournal.com/javascript/145766.html