you have to change the code
sb.Append("toast("+"" + msg + ""+","+"" + cls + ""+");");
to
sb.Append("alert("+"\"" + msg + ""+","+"" + cls + "\""+");");
you missed the quotes here that's the problem.
I don't know what do you mean atrractive msg boxes..