我有一个页面,我将另一页加载到此页面div部分:
<doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>TCS</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery- ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script type="text/javascript" src="http://latex.codecogs.com/latexit.js"></script>
<script type="text/javascript"> LatexIT.add('p',true)</script>
<script>
$(function() {
$( "#tabs" ).tabs();
$( "#tabs-1" ).load("b.html");
$( "#tabs-2" ).load("latex.html");
});
</script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Start</a></li>
<li><a href="#tabs-2">Latex/a></li>
<li><a href="#tabs-3">aaa</a></li>
</ul>
<div id="tabs-1">
</div>
<div id="tabs-2">
</div>
<div id="tabs-3">
</div>
</div>
</body>
</html>
所以,我用下一个代码加载latex.html:
<html>
<head>
<script type="text/javascript" src="http://latex.codecogs.com/latexit.js"></script>
<script type="text/javascript">
LatexIT.add('p',true);
</script>
</head>
<body>
<h1><p>Dividing $x^2+1$ by $y^2$ gives \[\frac{x^2+1}{y^2}\]</p></h1>
<p>The british pound is worth 1.5 US\$ or $1.1 \euro$</p>
</body>
</html>
如果我单独加载这个页面,我会得到正确的Latex表达式,而如果我将它加载到div中,我会得到像[\ frac {}之类的纯文本,依此类推。有什么问题和正确的方法呢?
答案 0 :(得分:0)
你可以试试这个:
$( "#tabs-2" ).load("latex.html", function(){
LatexIT.add('p',true);
});
答案 1 :(得分:0)
索引页面代码:
<doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>TCS</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script type="text/javascript" src="http://latex.codecogs.com/latexit.js"></script>
<script type="text/javascript"> LatexIT.add('p',true)</script>
<script>
$(function() {
$( "#tabs" ).tabs();
$( "#tabs-1" ).load("latex.html");
});
</script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Latext</a></li>
<li><a href="#tabs-3">aaa</a></li>
</ul>
<div id="tabs-1">
</div>
<div id="tabs-2">
</div>
<div id="tabs-3">
</div>
</div>
</body>
</html>
在latex.html页面上,只需输入(我删除所有其他html标签):
<h1><p>Dividing $x^2+1$ by $y^2$ gives \[\frac{x^2+1}{y^2}\]</p></h1>
<p>The british pound is worth 1.5 US\$ or $1.1 \euro$</p>