Math.Jax在H5中如何使用

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"></script>
	<script type="text/x-mathjax-config">
		MathJax.Hub.Config({
			jax: {
					inlineMath: [['$','$'], ['\(','\)']],
					processEscapes: true
				}
		});
	</script>
</head>
<body>

	<p id="h_title" style="font-size: 44px"></p>
	<div id="div_title" style="font-size: 40px">
	</div>

	<p id="h_answer" style="font-size: 44px"></p>
	<div id="div_answer" style="font-size: 40px">
	</div>


	<p id="h_parsing" style="font-size: 44px"></p>
	<div id="div_parsing" style="font-size: 40px">
	</div>


	<p id="h_knowledge" style="font-size: 44px"></p>
	<div id="div_knowledge" style="font-size: 40px">
	</div>

	<p id="h_no_data" style="font-size: 44px">
	</p>

	<script type="text/javascript">

		//显示题目
		function showTitle(title) {
			document.getElementById('h_title').innerHTML = '题目'
			document.getElementById('div_title').innerHTML = title
		}

		//显示答案
		function showAnswer(answer) {
			document.getElementById('h_answer').innerHTML = '答案'
			document.getElementById('div_answer').innerHTML = answer
		}

		//显示解析
		function showParsing(parsing) {
			document.getElementById('h_parsing').innerHTML = '解析'
			document.getElementById('div_parsing').innerHTML = parsing
		}

		//显示知识点
		function showknowledge(knowledge) {
			document.getElementById('h_knowledge').innerHTML = '知识点'
			document.getElementById('div_knowledge').innerHTML = knowledge
		}

		//显示无数据
		function showNoData() {
			document.getElementById('h_no_data').innerHTML = '抱歉,没有您想要获得的答案,可能是您拍的照片无法正确识别,请重新拍照上传'
		}

		var titles = 'A、 \\( a\\div b\\times a= \\frac{a^2 }{b } \\) ,计算错误;
B、 \\( a\\div b \\times \\frac 1b=\\frac{a }{b^2 } \\) ,计算错误;
C、 \\( \\frac 1a\\div a \\times a\\div \\frac 1a=1 \\) ,结算正确;
D、 \\( a^4\\div \\frac 1a\\div a^3=a^2 \\) ,计算错误.
故选C.'
showTitle(titles) </script> </body> </html>

你可能感兴趣的:(Web前端)