在360浏览器中,点击确定选择后没反应,提示:无法获取未定义或 null 引用的属性“document”

fkueyga6 2015-06-15 01:43:42
在360浏览器中,点击确定选择后没反应,提示:无法获取未定义或 null 引用的属性“document”,而在IE,QQ浏览器中正常
banji.htm:
<script type="text/javascript" src="/js/oa.js"></script>
<a href="javascript:oa_insert_banji({$banji.id},'{$type}');">确定选择</a>


oa.js:
function oa_insert_banji(banji_id,banji_type)
{
try
{
if(banji_type=='cur')
{
if( banji_id == $("input[name=pre_banji_id]",window.opener.document).val() )
{
alert('班级不能一样!');
return false;
}

$("input[name=cur_banji_id]",window.opener.document).val(banji_id);

$("#cur_didian",window.opener.document).html( $("#p_didian_"+banji_id).html() );
$("#cur_kemu",window.opener.document).html( $("#p_kemu_"+banji_id).html() );
$("#cur_banzhuren",window.opener.document).html( $("#p_banzhuren_"+banji_id).html() );
$("#cur_shijian",window.opener.document).html( $("#p_shijian_"+banji_id).html() );
}
else
{
if( banji_id == $("input[name=cur_banji_id]",window.opener.document).val() )
{
alert('班级不能一样!');
return false;
}

$("input[name=pre_banji_id]",window.opener.document).val(banji_id);
$("#pre_didian",window.opener.document).html( $("#p_didian_"+banji_id).html() );
$("#pre_kemu",window.opener.document).html( $("#p_kemu_"+banji_id).html() );
$("#pre_banzhuren",window.opener.document).html( $("#p_banzhuren_"+banji_id).html() );
$("#pre_shijian",window.opener.document).html( $("#p_shijian_"+banji_id).html() );
}

window.close();
}
else
{
txt="错误描述: " + err.description + "\n\n" /*在360里提示错误:无法获取未定义或 null 引用的属性“document”*/
alert(txt)
}
}
...全文
24798 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
forwardNow 2015-07-01
  • 打赏
  • 举报
回复
“webkit核心file协议浏览iframe,opener,parent无法交互。发布站点通过http协议访问。” 也就说,你把你的站点扔到服务器上去跑就OK了; 如果你懒得开服务器程序,那就用 Webstorm这个JavaScript IDE,它有内置的服务器程序。
  • 打赏
  • 举报
回复
这个问题我都赖的回答了
  • 打赏
  • 举报
回复
引用 9 楼 fkueyga6 的回复:
[quote=引用 8 楼 showbo 的回复:] 360 不要使用极速模式,极速模式用的webkit核心,webkit核心file协议浏览iframe,opener,parent无法交互。发布站点通过http协议访问。如果是chrome可以添加启动参数--allow-file-access-from-files,360不知道能否添加这个
是的,使用极速模式就不行,使用兼容模式就可以; 那请问怎么添加启动参数?[/quote] 看连接,不过不知道对360是否有效,对chrome是有效的
  • 打赏
  • 举报
回复
360 不要使用极速模式,极速模式用的webkit核心,webkit核心file协议浏览iframe,opener,parent无法交互。发布站点通过http协议访问。如果是chrome可以添加启动参数--allow-file-access-from-files,360不知道能否添加这个
fkueyga6 2015-06-29
  • 打赏
  • 举报
回复
引用 4 楼 KK3K2005 的回复:
alert(window.opener) 是什么?
提示:undefined
fkueyga6 2015-06-29
  • 打赏
  • 举报
回复
引用 8 楼 showbo 的回复:
360 不要使用极速模式,极速模式用的webkit核心,webkit核心file协议浏览iframe,opener,parent无法交互。发布站点通过http协议访问。如果是chrome可以添加启动参数--allow-file-access-from-files,360不知道能否添加这个
是的,使用极速模式就不行,使用兼容模式就可以; 那请问怎么添加启动参数?
zuojie_xqq 2015-06-19
  • 打赏
  • 举报
回复
你在oa_insert_banji函数的开头console.log(banji_id)和console.log(banji_type),根据值判断逻辑,然后再进去把Dom元素输出看看具体值,因为你这个根据报错的话猜测是获取元素时出错了。
fkueyga6 2015-06-19
  • 打赏
  • 举报
回复
引用 4 楼 KK3K2005 的回复:
alert(window.opener) 是什么?
没有alert(window.opener)这个啊?
KK3K2005 2015-06-17
  • 打赏
  • 举报
回复
alert(window.opener) 是什么?
香蕉猪 2015-06-17
  • 打赏
  • 举报
回复
是txt没定义???!!!
fkueyga6 2015-06-15
  • 打赏
  • 举报
回复
谁能告诉我原因啊?
fkueyga6 2015-06-15
  • 打赏
  • 举报
回复
这里写错了 else { txt="错误描述: " + err.description + "\n\n" /*在360里提示错误:无法获取未定义或 null 引用的属性“document”*/ alert(txt) } 改为: catch(err) { txt="错误描述: " + err.description + "\n\n" /*在360里提示错误:无法获取未定义或 null 引用的属性“document”*/ alert(txt) }

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧