I assume that there is a pretty easy answer for my question, but I am too new to identify the issue by myself.

All that I am attempting to do is properly echo out JS buttons in PHP, currently I can get them echoed but they are not functioning properly. They echo based off of the info in my database, but when they show up only the very top button shows the "over and out" images and all of the other buttons only show the first image when you hover over it with a mouse. If this does not make sense let me know and I will post a link.

PHP Code:


<a href=\"../../userprofile.php?username=
<img src=\"buttons/button1up.png\" border=\"0\" id=\"button1\" vspace=\"1\" hspace=\"1\">


var buttonFolder = "buttons/";

upSources = new Array("button1up.png");

overSources = new Array("button1over.png");

totalButtons = upSources.length;

function preload() {
for ( x=0; x<totalButtons; x++ ) {
buttonUp = new Image();
buttonUp.src = buttonFolder + upSources[x];
buttonOver = new Image();
buttonOver.src = buttonFolder + overSources[x];

function setOverImg(But, ID) {
document.getElementById('button' + But + ID).src = buttonFolder + overSources[But-1];

function setOutImg(But, ID) {
document.getElementById('button' + But + ID).src = buttonFolder + upSources[But-1];


Thanks in adavance!