i have a FOR loop that duplicates the same image across the screen. on each of these images i want an onClick event that sends a variable to a function that pertaines to the spacific image i've clicked.
my problem is that im trying to use the variable used in the FOR loop as my variablwe i want to pass. im not sure if this is correct and i hope i have explained it okay. the JS is below with a few other comments within it. thanks for the help.
<tr>
<SCRIPT LANGUAGE="JavaScript" type="text/JavaScript">
for (m=1; m<= 10; m++) {
document.write("<td>");
document.write("<a href='http://www.webdeveloper.com/forum/archive/index.php/#' onClick='alert(m);'>");
// using alert() for quick checking. need (m) to always be 1 on the first pic and 2 on the second and so one. these nubers are going to be added with a ".jpg".
document.write("<img src = 'http://www.webdeveloper.com/forum/archive/index.php/preview.gif' border='0''>");
document.write("</td>");
}
</SCRIPT>
</tr>
if you feel like chatting me through it, try Windows Messenger - <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
my problem is that im trying to use the variable used in the FOR loop as my variablwe i want to pass. im not sure if this is correct and i hope i have explained it okay. the JS is below with a few other comments within it. thanks for the help.
<tr>
<SCRIPT LANGUAGE="JavaScript" type="text/JavaScript">
for (m=1; m<= 10; m++) {
document.write("<td>");
document.write("<a href='http://www.webdeveloper.com/forum/archive/index.php/#' onClick='alert(m);'>");
// using alert() for quick checking. need (m) to always be 1 on the first pic and 2 on the second and so one. these nubers are going to be added with a ".jpg".
document.write("<img src = 'http://www.webdeveloper.com/forum/archive/index.php/preview.gif' border='0''>");
document.write("</td>");
}
</SCRIPT>
</tr>
if you feel like chatting me through it, try Windows Messenger - <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->