xiaosong8588
小狐狸
小狐狸
  • UID10017
  • 注册日期2005-11-23
  • 最后登录2006-10-07
  • 发帖数10
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
阅读:3536回复:0

求助高手:救命贴

楼主#
更多 发布于:2005-12-29 16:23
毕竟是js新手,
搞了点js库实现一些基本的功能,
准备测试这些库函数,写了点函数,结果发现要命的问题,
只要调用xpcom功能就会抛出异常,
这是我用javascript debugger追盅的结论,

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="yourwindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label value="Put your XUL here!"/>
<script>
function dotest3(){
try{
var aTitle="hello world!";                                                                                        
var aInitPath="file:///C:/Documents and Settings/xsong.SOURCESOFT/Desktop";                                                                                                                                                
 var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);    
      fp.init(window, aTitle, Components.interfaces.nsIFilePicker.modeGetFolder);                                                                                                                                        
      fp.show();  
}catch(e){alert(e)}
}
</script>


<button label="dotest3" id="button3" oncommand="dotest3();"/>
</window>


以上代码在xul设计器中可以探出打开文件对话框,但是转成xul文件在firefox中执行就不正常。

不知道各位大哥碰到这种情况没有,难道是我的firefox出问题了??

今天,我已经抓狂。。。。。。。。



游客

返回顶部