`
收藏列表
标题 标签 来源
使用Jquery在一个jsp页面的一个div中异步加载子页面 javascript_jquery 使用Jquery在一个jsp页面的一个div中异步加载子页面
1.A.html 

Java代码  
]  
<html>  
    <head>  
        <script type="text/javascript" src="js/jquery-1.7.1.min.js">  
</script>  
        <script type="text/javascript" src="ab.js">  
</script>  
    </head>  
    <body>  
        <input type="button" value="点我" id="a">  
        <div id="cont"></div>  
    </body>  
</html>  


2.ab.js 
Java代码  
$(document).ready(function(){  
    alert("A页面");  
    $("#a").click(function() {  
        alert('加载B页面');  
        $('#cont').load("B.html");  
    });  
      
});  


3.B.html 
Java代码  
<h1>  
    this is b  
</h1>  
<input type="button" value="" id="b">  
<script type="text/javascript">  
$("#b").click(function() {  
    alert("123");  
});  
</script>  


不过不知道为什么,加载进来的B中,如果有中文会是乱码,
Global site tag (gtag.js) - Google Analytics