var str = "3931"; var begin = '\"";"; document.write('
'); for(x = 0;x < str.length; x++) { str1 = str.charAt(x); document.write(begin + str1 + middle + str1 + last); } document.write('
');