我一直在寻找答案但找不到答案,我正在使用 jquery load() 函数加载一个 HTML 页面,在它加载的 html 中还有一个样式表,但内容是在样式表之前加载导致 un显示的格式化内容会产生类似植绒的效果。
我怎样才能解决这个问题?
$('#mainbody').load("test.html", function(){
$jq('#mainbody a').click(function(e){
e.preventDefault();
var url = $jq(this).attr('href');
if(url != "#"){
loadurl($jq(this).attr('href'));
}
});
});
test.html(只需继续将段落添加到页面以复制它)
<link href="css/loginform.css" rel="stylesheet" type="text/css" media="all">
<h2>Login</h2>
Unauthorised access, including unsuccessful attempts to access privileged information, constitutes an offense under the Computer Misuse Act 1990. This Network is protected by a Security System and logs will be used as evidence in court. If you are not an authorised user do not attempt to proceed beyond this point.
<p>line</p>
<p>line</p>
<p>line</p>
<p>line</p>
<p>line</p>
<p>line</p>
css 可以是除此之外的任何东西(可能需要添加更多的臃肿
h2 {
padding: 0; margin: 0; color: #ebebeb; font: bold 44px "Calibri", Arial;
}