這裏以後就是我的簡單HTML
代碼負載Mathjax加載JavaScript
<html>
<head>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script>
function gup(name)
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if(results == null)
return "";
else
return results[1];
}
</script>
</head>
<body>
<p>This is the line that load correct \[ \frac{x+y}{z} \]</p>
<p id="step1"></p>
<script>
var x = gup('x');
var y = gup('y');
var z = gup('z');
var text = "This is the line that NOT show correct" + "\[ \frac{" + x + " + " + y + "}{" + z +"}\]";
document.getElementById("step1").innerHTML= text;
</script>
</body>
</html>
當我加載此HTML文件和URL一樣
sample.html?x=1&y=2&z=3
的第一句話顯示正確的形式和負載Mathjax
但發送參數第二句話不是。這是因爲Mathjax
之前加載了java腳本代碼。你知道如何在Javascript
之後加載Mathjax
?
注:
在你的情況,這應該這樣做cdn.mathjax.org接近其結束生命,檢查https://www.mathjax.org/cdn - 關閉遷移提示(也許更新您的文章,供未來的讀者閱讀)。 –