Err ... this is javascript not java !!!
Your code might work better if you do something along the lines of: check if input 1 is blank (null or zero length string). If it is, set its contents to id, otherwise check if input 2 is blank. If it is, set its contents to id otherwise set input 3 contents to id.