请教:在a.htm文件中用iframe嵌入一个b.aspx文件。在b.aspx文件中输出什么语句能立即中断a.htm页面的运行。 在b.aspx中输出<script>alert('您无权查看该页,请返回首页登录!');window.parent.location='../';</scritp>时,a.htm的内容也输出了。。才跳回上级页面 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在b.aspx中输出<script>alert('您无权查看该页,请返回首页登录!');window.parent.location='../';</scritp>时,a.htm的内容也输出了。。才跳回上级页面 用一个Div包住a.htm的整个Form<script>document.parent.window.parent.document.getElementById("div ID").style.display="NONE";//设置div不可见,间接实现效果alert('您无权查看该页,请返回首页登录!');window.parent.location='../';</scritp> xxuu503但是兄台你打算把<script>document.parent.window.parent.document.getElementById("div ID").style.display="NONE";//设置div不可见,间接实现效果alert('您无权查看该页,请返回首页登录!');window.parent.location='../';</scritp>放在保处 a.htm:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=unicode"><META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD><BODY><div id='test' style="display:none"><form name='f1'><select name='test1'><option>1<option>21<option>13<option>ab<option>33</select><script>var select=document.f1.test1var ary=new Array()for(var i=0;0<select.options.length;i++){ary[i]=select.options[0].textselect.options.remove(0)}ary.sort()for(var i=0;i<ary.length;i++){ var option=document.createElement("Option") option.text=ary[i] select.add(option)}</script><iframe src='b.htm'></iframe></form></div></BODY></HTML>b.htm:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=unicode"><META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD><BODY><form name='f1'><select name='test1'><option>1<option>21<option>13<option>ab<option>33</select><script>if(confirm("通过验证么?")){window.parent.document.getElementById("test").style.display="block"}else{window.parent.location='http://www.baidu.com'}var select=document.f1.test1var ary=new Array()for(var i=0;0<select.options.length;i++){ary[i]=select.options[0].textselect.options.remove(0)}ary.sort()for(var i=0;i<ary.length;i++){ var option=document.createElement("Option") option.text=ary[i] select.add(option)}</script></form></BODY></HTML> 以上代码拿去验证吧!b.htm是a.htm的一个iframe在b.htm中控制了a的显示与否有效代码就是:window.parent.document.getElementById("test").style.display="block"对了,不好意思,里边还有一些垃圾代码忘记删掉了那是,给另外一问题"给options排序"写的测试代码!不过代码很简单,应该没问题的! 急 按键控制一个层 dhtmlXWindows的使用 紧急求助:如何给window增加一个子对象???? js中请问怎么在下拉列表实现多列呢? javascript中,setTimeout的小问题,在线等 请帮我一下 非常感谢您 如何给图片动态添加onclick事件。 如何用鼠标直接调整表格宽度~~ 如何用JAVASCRIPT来实现上一页、下一页翻转? 请问如何才能关闭整个页面??? textarea赋了值后,我如何换行? ASP 客户端 JAVASCRIPT 如何匹配中文字符?
时,a.htm的内容也输出了。。才跳回上级页面
document.parent.window.parent.document.getElementById("div ID").style.display="NONE";
//设置div不可见,间接实现效果
alert('您无权查看该页,请返回首页登录!');
window.parent.location='../';
</scritp>
但是兄台你打算把
<script>
document.parent.window.parent.document.getElementById("div ID").style.display="NONE";
//设置div不可见,间接实现效果
alert('您无权查看该页,请返回首页登录!');
window.parent.location='../';
</scritp>放在保处
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
</HEAD>
<BODY>
<div id='test' style="display:none">
<form name='f1'>
<select name='test1'>
<option>1
<option>21
<option>13
<option>ab
<option>33
</select>
<script>
var select=document.f1.test1
var ary=new Array()
for(var i=0;0<select.options.length;i++)
{
ary[i]=select.options[0].text
select.options.remove(0)
}
ary.sort()
for(var i=0;i<ary.length;i++)
{
var option=document.createElement("Option")
option.text=ary[i]
select.add(option)
}
</script>
<iframe src='b.htm'></iframe>
</form>
</div>
</BODY>
</HTML>b.htm:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
</HEAD>
<BODY>
<form name='f1'>
<select name='test1'>
<option>1
<option>21
<option>13
<option>ab
<option>33
</select>
<script>
if(confirm("通过验证么?"))
{
window.parent.document.getElementById("test").style.display="block"
}
else
{
window.parent.location='http://www.baidu.com'
}
var select=document.f1.test1
var ary=new Array()
for(var i=0;0<select.options.length;i++)
{
ary[i]=select.options[0].text
select.options.remove(0)
}
ary.sort()
for(var i=0;i<ary.length;i++)
{
var option=document.createElement("Option")
option.text=ary[i]
select.add(option)
}
</script>
</form>
</BODY>
</HTML>
对了,不好意思,里边还有一些垃圾代码忘记删掉了那是,给另外一问题"给options排序"写的测试代码!不过代码很简单,应该没问题的!