The trick is quoting each string with the other quote character:
temp.replace(/'/g, '"');
Edit: Ben Lee is correct about the regex, updated above. However, I still gather it that you want to replace with " (one double quote), not '' (two single quotes).