Thanks for your kind words about MathJax. I'm glad it is working for you.
It is not too hard to do what you request, but there are a number of issues to keep in mind. First, you want to make sure that the "speed" button is disabled if the native MathML support is not available. Second, you probably want the user's choice to persist from page to page, so you will have to save the setting in the MathJax menu cookie, and you will want to check that value when the page startup up so that the initial setting is correct.
Here is a sample file that does all of that. Most of the code (all but two lines) is in order to handle the two concerns above. You need to be sure to link into MathJax's startup process at the correct times, so that you are synchronized with the actions of MathJax.
<html>
<head>
<title>MathJax Renderer Change Test</title>
<script src="/MathJax/MathJax.js">
MathJax.Hub.Config({
jax: ["input/TeX","output/HTML-CSS","output/NativeMML"], // load both output formats
config: ["MMLorHTML.js"], // Use MMLorHTML to see if MathML is available
MMLorHTML: {prefer: "MML"}, // try for MML in all browsers
MathMenu: {showRenderer: false}, // Don't allow renderer changes by menu
extensions: ["tex2jax.js"],
tex2jax: {inlineMath: [['$','$'],['\\(','\\)']]}
});
(function () {
var button;
//
// After the configuration is done (i.e. MMLorHTML has completed):
// Determine if NativeMML is supported
// When the page is ready:
// Get the button elements (for future reference)
// Disable the MML button, if NativeMML is not supported
// Check the proper button if there is a menu-selected renderer
//
MathJax.Hub.Register.StartupHook("End Config",function () {
var MMLdisabled = (MathJax.Hub.config.jax.shift() !== "output/NativeMML");
MathJax.Hub.Register.StartupHook("onLoad",function () {
button = {
"HTML-CSS": document.getElementById("HTML-CSS"),
"NativeMML": document.getElementById("NativeMML")
};
if (MMLdisabled) {button["NativeMML"].disabled = true}
var renderer = MathJax.HTML.Cookie.Get("menu").renderer;
if (renderer && !button[renderer].disabled) {button[renderer].checked = true}
});
//
// If the renderer button is disabled, do nothing
// Check the appropriate button
// Save the new renderer in the menu settings cookie
// Change the selected renderer and reprocess the page
//
window.setRenderer = function (renderer) {
if (button[renderer].disabled) return;
button[renderer].checked = true;
MathJax.Hub.config.menuSettings.renderer = renderer;
MathJax.HTML.Cookie.Set("menu",MathJax.Hub.config.menuSettings);
MathJax.Hub.config.outputJax["jax/mml"] = [MathJax.OutputJax[renderer]];
MathJax.Hub.Queue(["Reprocess",MathJax.Hub]);
};
})();
</script>
</head>
<body>
<fieldset style="width:7em">
<legend>Math Options</legend>
<div style="padding-left:.75em">
<input type="radio" checked="true" name="renderer"
id="HTML-CSS" onclick="setRenderer(this.id)" /> <label>Beauty</label><br> <input type="radio" name="renderer" id="NativeMML"
onclick="setRenderer(this.id)"/> <label>Speed</label> </div>
</fieldset>
<p>
This is a test of changing rednerers.
Some inline math $\sqrt{1-x}$ and some display math $${x+1\over1-x}.$$
</p>
</body>
</html>