以下是download_tree.js的代码:
/*
* Ext JS Library 2.1
* Copyright(c) 2006-2008, Ext JS, LLC.
* [email protected]
*
* http://extjs.com/license
*/Ext.onReady(function(){
// shorthand
var Tree = Ext.tree;
function fun(node){
if(node.leaf==true){
var frame = parent.document.getElementById("mainFrame");
frame.src=url_root+'/archive/DownloadDoc.a?selectInfo&cid='+node.id;
}
}
var tree = new Tree.TreePanel({
el:'tree-div',
useArrows:false,
autoScroll:true,
rootVisible:false,
animate:true,
//enableDD:true,
containerScroll: false,
baseCls:'',
listeners:{click:fun},
loader: new Tree.TreeLoader({
dataUrl:url_root+'/ClassTreeAction.a?queryTreeNode'
})
}); // set the root node
var root = new Tree.AsyncTreeNode({
text: 'Ext js',
draggable:false,
id:'source'
});
tree.setRootNode(root);
// tree.setRootVisible(false); // render the tree
tree.render();
// root.expand();
});运行后提示:
网页错误详细信息用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152)
时间戳: Wed, 26 Dec 2012 06:18:54 UTC
消息: 'null' 为空或不是对象
行: 16
字符: 9
代码: 0
URI: http://192.168.1.121/qasss/archive/download_tree.js我现在用的是IE8,原来用IE6的时候似乎没这个问题。我现在不知道怎么改才能适应IE8,高手帮我看看,怎么修改合适?感谢!
/*
* Ext JS Library 2.1
* Copyright(c) 2006-2008, Ext JS, LLC.
* [email protected]
*
* http://extjs.com/license
*/Ext.onReady(function(){
// shorthand
var Tree = Ext.tree;
function fun(node){
if(node.leaf==true){
var frame = parent.document.getElementById("mainFrame");
frame.src=url_root+'/archive/DownloadDoc.a?selectInfo&cid='+node.id;
}
}
var tree = new Tree.TreePanel({
el:'tree-div',
useArrows:false,
autoScroll:true,
rootVisible:false,
animate:true,
//enableDD:true,
containerScroll: false,
baseCls:'',
listeners:{click:fun},
loader: new Tree.TreeLoader({
dataUrl:url_root+'/ClassTreeAction.a?queryTreeNode'
})
}); // set the root node
var root = new Tree.AsyncTreeNode({
text: 'Ext js',
draggable:false,
id:'source'
});
tree.setRootNode(root);
// tree.setRootVisible(false); // render the tree
tree.render();
// root.expand();
});运行后提示:
网页错误详细信息用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152)
时间戳: Wed, 26 Dec 2012 06:18:54 UTC
消息: 'null' 为空或不是对象
行: 16
字符: 9
代码: 0
URI: http://192.168.1.121/qasss/archive/download_tree.js我现在用的是IE8,原来用IE6的时候似乎没这个问题。我现在不知道怎么改才能适应IE8,高手帮我看看,怎么修改合适?感谢!
解决方案 »
- scriptx哪几个属性是免费的?怎么安装使用啊?是不是只需要下载那个smsx.cab包就行了?
- jqgrid的问题
- 大家谁知道怎样实现在下拉框中通过输入汉字的拼音首字母进行检索下拉框内容的功能,下拉框的内容是从数据库中取的。
- 如何在客户端用JS载入文本文件
- javascript 如何获得鼠标位置单击后的屏幕位置(FF&IE)?
- MzTreeView2.0惰性加载节点的问题
- 我已经提前载入图片了,为什么还这么慢?
- Ext:右键点击树节点,为什么两个判断都返回false呢
- 用JavaScript如何画生物节律曲线?
- 这个问题不太好说清…请老师看看
- HTML源码保护
- 关于浏览器拦截弹出窗口的问题(谢谢帮忙!)
你发错版块了
frame.src=url_root+'/archive/DownloadDoc.a?selectInfo&cid='+node.id;你页面不存在mainFrame这个ID的控件吧
改成 var frame = getIFrameDOM("mainFrame");试试
getIFrameDOM为自定义函数?
frame ?
var frame = parent.getIFrameDOM("mainFrame");
在一个它的上级download_classtree.jsp文件中这样定义的:
<script>
var url_root="${ctx}";
</script>
在这一行加上alert(frame)来看结果,显示frame没有获取到值,所以报错为null
我这两天耐着性子把代码看了一遍,拿搜索工具协助找关键词。我在var frame = parent.document.getElementById("mainFrame");里,
在这一行下面加上alert(frame)来看结果,显示frame没有获取到值,所以报错为null。
最终发现问题出在调用download_tree.js的上级文档download_main.html中的
<frame src="download_readme.jsp" name="mainFrame" scrolling="yes" noresize marginwidth="160" bordercolor="#828282" title="leftFrame">
缺少id="mainFrame",使得
parent.document.getElementById("mainFrame")在IE8中获取不到数据。加上id="mainFrame"后,问题解决。经过扩展阅读,这种情况还存在很多处。奶奶的,国内很多像垃圾一样的所谓软件公司,在IE6下写的东西就不知道在IE8或其他主流浏览器下测试做兼容性处理,做出来的东西堪称“垃圾中的战斗机”!感谢楼上各位朋友倾情相助!分就平均给了,呵呵,祝大家新年快乐,注意身体!