troubleshooting Question

Turn getElementByID click into a passable parameter

Avatar of Shaye Larsen
Shaye Larsen asked on
JavaHTMLJSP
13 Comments1 Solution801 ViewsLast Modified:
I have a series of images that each have a unique ID.  When a user clicks on an image thumbnail, it loads a preview window by using onClick="document.getElementById('0029a').checked=true;" to tell which image was selected.

Once they select an image, I need to take the same ID number and pass it to the next page if they click next.  I am not sure how to get that ID and turn it into a variable that I can pass along. I would like it to work where their click is what determines the variable and when they click next, I can send that variable along.

The input tag you see will not be used in this case.  I have an if then statement that determines if the user is submitting the form now or going to the next page.  The submit form functionality works fine.  It is passing the variable on to the next page that I need help with.
Here is the link and thumbnail image with a hardcoded ID, other images have other hardcoded IDs.
 
<a href="images/instant_sites/preview/0029a.jpg" rel="enlargeimage::click" rev="loadarea" title="Click to Preview" class="style45">
			<img class="designiframeselectimage" onClick="document.getElementById('0029a').checked=true;" src="images/instant_sites/thumbnail/0029a.jpg" border="0"></a>
<input id="0029a" style="visibility:hidden" <% if (ResponseBean.getDynamicPagesTemplateReference(0).equalsIgnoreCase("0029a")){%> checked <%}%> type="radio" 
			name="<%= com.ideaorbit.servlets.DynamicPagesEditExecuteServlet.HTTP_REQUEST_FIELD_KEY_TEMPLATE_REFERENCE %>" value="0029a" />
 
 
Here is the preview div
 
 <div class="designiframepreview">
<div id="loadarea" align="left" class="designiframepreviewimage"><div align="center" class="blank_instructions">
Click a thumbnail<br>to preview site.<br><font size="+6">&larr;</font>
</div></div>
 
Here is the link, the parameter tempref is where I need to send along the value (in this case 0029a) depending on what image they selected above.
 
<a href="m1_dynamic_add.jsp?version=<%=versiontemp%>&tempref=">Next</a>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 13 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros