Javascript problem regarding sending the correct href into the DOM