It's kind of a strange problem. Triple nesting of quotes isn't possible, so you would think escaping the double quotes around Tom would work, but it doesn't. As far as I can tell, the rule is: you can only escape quotes that are the same as the next set of quotes surrounding that part of the string.
So, one solution is to start with single quotes:
onmouseover='change("My name is \"Tom\".")'
Or, strangely enough, what also works is using the html symbol for a quote: "
onclick="g('My name is "Tom".')"
but that is an ugly solution.
Question. Why do you have:
before the function name?