A few questions...

admin

Administrator
Staff member
I have a question for you guys... Here is some code:

<html>
<script language=javascript>
document.write("<Form>");
for(x=0;x<3;x++)
{
document.write("<input type='button' Name='test'+x onclick='OpenLink(x)' <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/value='value'">http://www.webdeveloper.com/forum/archi ... ue='value'</a><!-- m -->>\n");
}
document.write("</Form>");
function OpenLink(x)
{
alert(x)
}
</script>
</html>

It generates three buttons and runs the OpenLink function when you click on one. The problem is that all of the buttons return what x is currently at (3) when the button is clicked. I wan't them to return the number of the button that was clicked. I hope that wasn't to confusing... :) Let me know if you don't know what I mean... Thanks, Adam
 
Top