HTML:
<body>
<form id="form1" runat="server">
<div>
<div class="text-tabs">/*导航栏*/
<a class="text-tab" data-target="/" href="javascript:void(0);" onclick="skipto(this);"><span>首页</span></a>
</div>
<div id="login" style=" 200px; height:400px; float:left;">default.aspx</div>
<iframe src="/head.html?parame=head_introduce" frameBorder="0" width="100%" scrolling="no" height="61px"></iframe>
</div>
</form>
</body>
JQ:
$(function() {
//在iframe中查找父页面元素
alert($('#default', window.parent.document).html());
//在iframe中调用父页面中定义的方法
parent.getHelloWorld();
//在iframe中调用父页面中定义的变量
alert(parent.hello);
//从父页面中打开网页
parent.location.href = '/index.html';
var login = request('login');
var token = request('access_token');
var parame = request('parame');
function skipto(obj){
if(token!=''){
parent.location.href=$(obj).attr('data-target')+'?login=' + login + '&access_token=' + token + '';
}
else{
parent.location.href=$(obj).attr('data-target');
}
}
});
</script>