i have it working if i do not try a variable with it

document.formName.selectName.selectedIndex = "0";

when using it in a function with variables it doesnt work
Code:
function bob(fname,sname){
var rsel= 'document.'+fname+'.'+sname+'.selectedIndex = ';rsel+"0";
}