如何在指定div里面打开新页面
展开全部
两种方式,
用iframe实现,div中嵌套一个<iframe name="myiframe">
a标签加一个target属性,<a href="aaa.html" target="myiframe"></a>
2. 用ajax实现,
给div加一个id <div id = "mydiv"><div>
js中
1
2
3
4
5
6
$('a').click(function(){
returnValue = false;
$.<a href="https://www.baidu.com/s?wd=get&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YkmWb3uAR4n1c1m16vrycs0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPW64nHfLn16srj0dPHRvP1mY" target="_blank" class="baidu-highlight">get</a>($(this).attr('href'),function(d){
$('#mydiv').html(d);
});
}
用iframe实现,div中嵌套一个<iframe name="myiframe">
a标签加一个target属性,<a href="aaa.html" target="myiframe"></a>
2. 用ajax实现,
给div加一个id <div id = "mydiv"><div>
js中
1
2
3
4
5
6
$('a').click(function(){
returnValue = false;
$.<a href="https://www.baidu.com/s?wd=get&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YkmWb3uAR4n1c1m16vrycs0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPW64nHfLn16srj0dPHRvP1mY" target="_blank" class="baidu-highlight">get</a>($(this).attr('href'),function(d){
$('#mydiv').html(d);
});
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询