function doPic(imgName) { var imgon = imgName; document.mainpic.src = imgon; }