|
阅读:4624回复:5
求助!求助! Mozilla下的Javascript。运行中断
下面是我同事写的Javascript,在IE下运行正常,在Mozilla下有错误,并且中断。请大家看看,到底发生了什么问题,急急急!!!
问题描述:在IE下onclick后运行OK。 在Mozilla下,提示 ***************************************************** Error: top.bottomFrame.FileManagement1 has no properties Source File: http://192.168.216.108/fmmainframe?currpath=/ Line: 13 ***************************************************** 大虾们,你们说哪个地方写的不对? <html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<title>topFrame</title>
</head>
<body>
<table width="100%">
<tr>
<td width="30%"><font style="font-size: 10pt; color:#6633CC"><b>Disk Total Used:</b></font></td>
<td width="70%"><font style="font-size: 10pt; color:#000066"><b> 47104 bytes / 8357888 Bytes (0.56%)</b></font></td>
</tr>
<tr>
<td width="30%"><font style="font-size: 10pt; color:#6633CC"><b>Current Path:</b></font></td>
<td width="70%"><font style="font-size: 10pt; color:#000066"><b>/</b></font></td>
</tr>
</table>
<table width="100%">
<tr>
<form name="FileManage" action="/FileManage" target=_top>
<input type="hidden" name="currpath" value="/">
<td align="center" width="25%"><input value="Parent Folder" name="Parent_Folder_Button" type="submit" style="height:20px;width:100px;font-size:10pt;"></td>
<td align="center" width="25%"><input value="Root Folder" name="Root_Folder_Button" type="submit" style="height:20px;width:100px;font-size:10pt;"></td>
<td align="center" width="25%"></td>
<td align="center" width="25%"><input value="ReturnMenu" name="Retrrn_Menu" type="submit" style="height:20px;width:100px;font-size:10pt;"></td>
</form>
</tr>
</table>
<table width="100%">
<tr align="center" bgcolor="#EFEFEF">
<td width="5%" align="center">
<input type="radio" name="folder_id" checked value="0">
</td>
<td width="40%" align="center"><font style="font-size: 10pt; color:#6633CC"><b>Folder and File</b></font></td>
<td width="20%" align="center"><font style="font-size: 10pt; color:#6633CC"><b>Size(bytes)</b></font></td>
<td width="35%" align="center"><font style="font-size: 10pt; color:#6633CC"><b>Date</b></font></td>
</tr>
</table>
</form>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<title>mainFrame</title>
<script language="javascript">
function topage(pathname)
{
document.DirPath.currpath.value=pathname;
document.DirPath.submit();
}
function radio_select(d1,d2,d3)
{
top.bottomFrame.FileManagement1.currpath1.value=d1;
top.bottomFrame.FileManagement1.fileorfolder1.value=d2;
top.bottomFrame.FileManagement2.currpath2.value=d1;
top.bottomFrame.FileManagement2.fileorfolder2.value=d2;
if(d2 == "0"){
top.bottomFrame.FileManagement1.Submit.disabled=true;
top.bottomFrame.FileManagement2.Submit.disabled=false;
} else {
top.bottomFrame.FileManagement1.Submit.disabled=false;
top.bottomFrame.FileManagement2.Submit.disabled=false;
}
}
</script>
</head>
<body>
<table width="100%">
<tr align="center">
<td width="5%" align="center">
<input type="radio" name="folder_id" id="0" value="/DEV"
onClick="javascript:radio_select(this.value,this.id)">
</td>
<td width="40%" align="left">
<a href=javascript:topage("/DEV")>
<font style="font-size: 10pt; word-break:break-all">
DEV</font></a></td>
<td width="20%" align="center"><font style="font-size: 10pt">
&DIR&</font></td>
<td width="35%" align="center"><font style="font-size: 10pt">
2005/06/16 15:19</font></td>
</tr>
<tr align="center">
<td width="5%" align="center">
<input type="radio" name="folder_id" id="0" value="/LOG"
onClick="javascript:radio_select(this.value,this.id)">
</td>
<td width="40%" align="left">
<a href=javascript:topage("/LOG")>
<font style="font-size: 10pt; word-break:break-all">
LOG</font></a></td>
<td width="20%" align="center"><font style="font-size: 10pt">
&DIR&</font></td>
<td width="35%" align="center"><font style="font-size: 10pt">
2005/06/16 15:19</font></td>
</tr>
<tr align="center">
<td width="5%" align="center">
<input type="radio" name="folder_id" id="0" value="/S700P"
onClick="javascript:radio_select(this.value,this.id)">
</td>
<td width="40%" align="left">
<a href=javascript:topage("/S700P")>
<font style="font-size: 10pt; word-break:break-all">
S700P</font></a></td>
<td width="20%" align="center"><font style="font-size: 10pt">
&DIR&</font></td>
<td width="35%" align="center"><font style="font-size: 10pt">
2005/06/16 15:19</font></td>
</tr>
<tr align="center">
<td width="5%" align="center">
<input type="radio" name="folder_id" id="0" value="/CAMERA"
onClick="javascript:radio_select(this.value,this.id)">
</td>
<td width="40%" align="left">
<a href=javascript:topage("/CAMERA")>
<font style="font-size: 10pt; word-break:break-all">
CAMERA</font></a></td>
<td width="20%" align="center"><font style="font-size: 10pt">
&DIR&</font></td>
<td width="35%" align="center"><font style="font-size: 10pt">
2005/06/16 15:19</font></td>
</tr>
<tr align="center">
<td width="5%" align="center">
<input type="radio" name="folder_id" id="0" value="/PROC"
onClick="javascript:radio_select(this.value,this.id)">
</td>
<td width="40%" align="left">
<a href=javascript:topage("/PROC")>
<font style="font-size: 10pt; word-break:break-all">
PROC</font></a></td>
<td width="20%" align="center"><font style="font-size: 10pt">
&DIR&</font></td>
<td width="35%" align="center"><font style="font-size: 10pt">
2005/06/16 15:19</font></td>
</tr>
</table>
<form name="DirPath" action="/FileManage" method="post" target=_top>
<input type="hidden" name="currpath" value="/">
</form>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<title>bottomFrame</title>
</head>
<body>
<table width="100%">
<tr>
<form name="FileManagement1" action="/FileManage" method="post" target=_top>
<input type="hidden" name="currpath1" value="default">
<input type="hidden" name="fileorfolder1" value="0">
<td align="center" width="25%">
<input name="Submit" value="View" disabled type="submit" style="height:20px;width:100px;font-size:10pt;"></td>
</form>
<form name="FileManagement2" action="/FileManage" method="post" target=_top>
<input type="hidden" name="currpath2" value="default">
<input type="hidden" name="fileorfolder2" value="0">
<td align="center" width="25%">
<input name="Submit" value="Remove" disabled type="submit" style="height:20px;width:100px;font-size:10pt;"></td>
</form>
<td colspan="1" align="center"></td>
<td colspan="1" align="center"></td>
</tr>
</table>
</body>
</html> |
|
|
|
1楼#
发布于:2005-06-16 21:49
用dom操作元素,不要用成员属性来写。
用 try {} catch(e) {} 捕捉异常 |
|
|
|
2楼#
发布于:2005-06-16 21:49
还是不行啊
我做了下面的调整:
<form name="FileManagement1" id="FM1" action="/FileManage" method="post" target=_top> 和: function radio_select(d1,d2) { top.bottomFrame.getElementById("FM1").currpath1.value=d1; top.bottomFrame.getElementById("FM1").fileorfolder1.value=d2; top.bottomFrame.getElementById("FM2").currpath2.value=d1; top.bottomFrame.getElementById("FM2").fileorfolder2.value=d2; if(d2 == "0"){ top.bottomFrame.getElementById("FM1").Submit.disabled=true; top.bottomFrame.getElementById("FM2").Submit.disabled=false; } else { top.bottomFrame.getElementById("FM1").Submit.disabled=false; top.bottomFrame.getElementById("FM2").Submit.disabled=false; } } 然后错误提示变成了:(而且在IE里边也提示“不支持此属性或方法”) ************************************************** Error: top.bottomFrame.getElementById is not a function Source File: http://192.168.216.108/fmmainframe?currpath=/ Line: 13 ************************************************** 那儿错了?怎么办? |
|
|
|
3楼#
发布于:2005-06-16 21:49
top.bottomFrame.contentDocument.getElementById
|
|
|
4楼#
发布于:2005-06-16 21:49
猫头猪:top.bottomFrame.contentDocument.getElementById回到原帖 是这样? top.bottomFrame.contentDocument.getElementById("FM1").currpath1.value=d1; 还是不行。 提示如下: ***************************************************** Warning: Non-standard document.all property was used. Use W3C standard document.getElementById() instead. Source File: http://www.neusoftonline.com/study/cour ... /index.htm Line: 11 ***************************************************** 和 ***************************************************** Error: aDragSession.sourceNode has no properties Source File: chrome://communicator/content/bookmarks/bookmarksMenu.js Line: 613 ***************************************************** |
|
|
|
5楼#
发布于:2005-06-16 21:49
谢谢大家的帮助。
我们用其他的方法实现了这个功能。就是再做一个函数,放在bottomframe里边。函数内部就可以使用document.FileManagement1.然后调用这个函数。这样就避免了使用top.bottomFrame.FileManagement1的形式。 再次感谢大家。
^_^ |
|
|