By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,573 Members | 903 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,573 IT Pros & Developers. It's quick & easy.

Help! document.getElementById("folderMenu").cells has no properties when using FireFox

P: n/a
Error: document.getElementById("folderMenu").cells has no properties
File: http://www.volkswagen.se/tillbehor/js/foldermenu.js
Rad: 49

The function activates different DIV:s, but doesn't seem to work on
FireFox or Netscape. What could be wrong?

The function:

function setActiveTab(tabNo) {
tmpTab =
document.getElementById("folderMenu").cells[tabNo].childNodes.item(0);
activeTab = tmpTab;
switchTabStyle(tmpTab,true);
document.getElementById("divFolder"+activeTab.getA ttribute("divno")).style..visibility="visible";
}

The file with the DIV:s and Tables from where the function is called,
in the init() fuction:

<HTML>
<HEAD>
<TITLE>Tillbeh&ouml;rskatalogen</TITLE>
<LINK TYPE="text/css" REL="stylesheet" HREF="<%=cssPath%>">
<LINK TYPE="text/css" REL="stylesheet" HREF="css/foldermenu.css">
<SCRIPT LANGUAGE="Javascript" SRC="js/foldermenu.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="js/dimlayer.js"></SCRIPT>
<SCRIPT LANGUAGE="Javascript">
function init() {
setActiveTab(0);
clearYear();
}
function enableDropdowns() {
document.getElementById("omrade").disabled = false;
document.getElementById("ar").disabled = false;
}
function disableDropdowns() {
window.iframeModelGroup.document.getElementById("p opmodellnamn").selectedIndex
= 0;
window.iframeModelGroup.document.getElementById("p opmodellnamn").disabled
= true;
document.getElementById("popmodellnamn").value = "";
window.iframeModelName.document.getElementById("mo dellnamn").selectedIndex
= 0;
window.iframeModelName.document.getElementById("mo dellnamn").disabled
= true;
document.getElementById("modellnamn").value = "";
}
function clearYear() {
document.getElementById("ar").selectedIndex = 1;
disableDropdowns();
document.getElementById("ar").onchange();
}
function getDropdown(refForm) {
var chBrand = '<%=vchBrand%>';
disableDropdowns();
refForm.target='iframeModelGroup';
refForm.action='getDropDown.asp?type=modelGroup&ma ke=' + chBrand;
refForm.submit();target='frStage';
refForm.target='frStage';
refForm.action='main.asp?searchType=Modellkod';
}
function enableArtNo(makeID) {
if (makeID != "0") {
document.getElementById("artnr").disabled = false;
} else {
document.getElementById("artnr").disabled = true;
}
}
function enableFritext(makeID) {
if (makeID != "0") {
document.getElementById("fritext").disabled = false;
} else {
document.getElementById("fritext").disabled = true;
}
}
function checkMake(element) {
var bOK = false;
if (! document.getElementById(element).disabled) {
bOK = true
} else {
alert("Du måste välja märke!");
}
return bOK;
}
function goHome(){
window.parent.frStage.location = 'start.asp';
}
function visa(){
parent.frStage.document.all.reservationtext.style. visibility =
"visible";
}
function dolj(){
parent.frStage.document.all.reservationtext.style. visibility =
"hidden";
}

//DAVID
function validateSearchForm() {
if(document.forms('formRegNr').regnr.value!=''){
if(document.forms('formRegNr').omrade.value!=0){
return true;
}
else{
alert('Du måste ange en kategori');
toggleDimLayer(false);
return false;
}
}
else{
alert('Du måste ange ett regnummer');
toggleDimLayer(false);
return false;
}
}
//DAVID

function CheckReg(){
if(document.forms('formRegNr').regnr.value!=''){
Kategori();
}
else{
alert('Du måste ange ett regnummer');
return;
}

}
function Kategori(){
if(document.forms('formRegNr').omrade.value!=0){
document.forms('formRegNr').submit();
}
else{
alert('Du måste ange en kategori');
return;
}
}
</SCRIPT>
<STYLE TYPE="text/css">
..divFolder0 {
position: absolute;
visibility: visible;
left: 20px;
top: 80px;
}
..divFolder1 {
position: absolute;
visibility: hidden;
left: 20px;
top: 80px;
}
#divHeader {
position: absolute;
visibility: visible;
left: 586px;
top: 15px;
}
#folderMenuHeader {
position: absolute;
left: 20px;
top: 46px;
}
..folderMenuHeaderText {
font-family: verdana,arial,helvetica;
font-size: 12px;
font-weight: bold;
}
#divLogo {
position: absolute;
visibility: visible;
left: 10px;
top: 9px;
}
#divTBKS {
position: absolute;
visibility: visible;
left: 335px;
top: 5px;
}
</STYLE>
</HEAD>
<BODY BACKGROUND="imgs/tab_bg_2.gif" ONLOAD="init();" BGCOLOR="#FFFFFF"
LEFTMARGIN="0" TOPMARGIN="0">
<DIV ID="divHeader"><IMG SRC="imgs/tbk.gif" WIDTH="188" HEIGHT="32"
BORDER="0"></DIV>
<DIV ID="divLogo"><IMG SRC="<%=logoPath%>" BORDER="0"></DIV>
<TABLE NAME="folderMenu" ID="folderMenu" BORDER="0" CELLPADDING="0"
CELLSPACING="0" ONSELECTSTART="return false;">
<TR>
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"
ONCLICK="activateFolder(this);" DIVNO="0" CLASS="tabContainer">
<TR>
<TD CLASS="tabLeftOff" ROWSPAN="3"><IMG SRC="imgs/dutt.gif" WIDTH="12"
HEIGHT="22" BORDER="0"></TD>
<TD WIDTH="100" CLASS="tabTopOff"><IMG SRC="imgs/dutt.gif" WIDTH="4"
HEIGHT="3" BORDER="0"></TD>
<TD CLASS="tabRightOff" ROWSPAN="3"><IMG SRC="imgs/dutt.gif"
WIDTH="11" HEIGHT="22" BORDER="0"></TD>
</TR>
<TR>
<TD ALIGN="center" CLASS="tabTextOff">Reg.nr.</TD>
</TR>
<TR>
<TD CLASS="tabBottomOff"><IMG SRC="imgs/dutt.gif" WIDTH="1" HEIGHT="1"
BORDER="0"></TD>
</TR>
<TR>
<TD COLSPAN="3" CLASS="tabBottom2Off"><IMG SRC="imgs/dutt.gif"
WIDTH="1" HEIGHT="1" BORDER="0"></TD>
</TR>
</TABLE></TD>
<TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"
ONCLICK="activateFolder(this);" DIVNO="1" CLASS="tabContainer">
<TR>
<TD CLASS="tabLeftOff" ROWSPAN="3"><IMG SRC="imgs/dutt.gif" WIDTH="12"
HEIGHT="22" BORDER="0"></TD>
<TD WIDTH="100" CLASS="tabTopOff"><IMG SRC="imgs/dutt.gif" WIDTH="4"
HEIGHT="3" BORDER="0"></TD>
<TD CLASS="tabRightOff" ROWSPAN="3"><IMG SRC="imgs/dutt.gif"
WIDTH="11" HEIGHT="22" BORDER="0"></TD>
</TR>
<TR>
<TD ALIGN="center" CLASS="tabTextOff">Modell</TD>
</TR>
<TR>
<TD CLASS="tabBottomOff"><IMG SRC="imgs/dutt.gif" WIDTH="1" HEIGHT="1"
BORDER="0"></TD>
</TR>
<TR>
<TD COLSPAN="3" CLASS="tabBottom2Off"><IMG SRC="imgs/dutt.gif"
WIDTH="1" HEIGHT="1" BORDER="0"></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE>
<DIV ID="divFolder0" CLASS="divFolder0">
<FORM NAME="formRegNr"
ACTION="main.asp?searchType=RegNr&brand=<%=vchBran d%>" METHOD="post"
TARGET="frStage" onsubmit="toggleDimLayer(true); return
validateSearchForm();">
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD><B>Reg.nr.</B></TD>
<TD STYLE="padding-left: 10px"><INPUT TYPE="text" NAME="regnr"
CLASS="regnr" MAXLENGTH="6"><IMG SRC="imgs/bg_trans.gif" WIDTH="140"
HEIGHT="1" BORDER="0"></TD>
<TD STYLE="padding-left: 20px;">&nbsp;</TD>
<TD STYLE="padding-left: 20px;"><SELECT NAME="omrade" CLASS="dd">
<OPTION VALUE="0">V&auml;lj tillbeh&ouml;rsgrupp</OPTION>
<%=strCat%>
<% '<OPTION VALUE="-1" <% If CInt(omrade) = -1
Then>Paket</OPTION>
%>
</SELECT></TD>
<TD STYLE="padding-left: 16px;"><SPAN CLASS="bnBorder"><INPUT
TYPE="submit" CLASS="bn" VALUE="S&ouml;k"
onclick="toggleDimLayer(true); return validateSearchForm();"
HIDEFOCUS></SPAN></TD>
<TD STYLE="padding-left: 16px;"><SPAN CLASS="bnBorder"><INPUT
TYPE="button" CLASS="bn" VALUE="Start" onClick="goHome();"
HIDEFOCUS></SPAN></TD>
</TR>
<TR STYLE="padding-top: 7px;">
<TD COLSPAN="2"></TD>
<TD STYLE="padding-left: 40px;" colspan=2><INPUT type="hidden"
CLASS="chk" TYPE="checkbox" NAME="pris" value="1"
ID="pris">&nbsp;<!--b>Visa pris (Inkl. moms)</b--></TD>
</TR>
<TR>
<TD colspan="5">
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD><B>Sökanvisning:&nbsp;</B></TD>
<TD><B>1</B>&nbsp;Skriv reg. nummer.</TD>
</TR>
<TR>
<TD>&nbsp;</TD>
<TD><B>2</B>&nbsp;Välj tillbehörsgrupp</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</FORM>
</DIV>
<DIV ID="divFolder1" CLASS="divFolder1">
<FORM NAME="formModelGroup" ACTION="main.asp?searchType=Modellkod"
METHOD="post" TARGET="frStage" ONSUBMIT="toggleDimLayer(true);">
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD VALIGN="top" STYLE="padding-left: 30px;"><SELECT NAME="omrade"
CLASS="dd">
<OPTION VALUE="1">V&auml;lj tillbeh&ouml;rsgrupp</OPTION>
<%=strCat%>
<%'<OPTION VALUE="-1"<% If CInt(omrade) = -1 Then>Paket</OPTION>
%>
</SELECT></TD>
<TD VALIGN="top" STYLE="padding-left: 30px;">
<SELECT NAME="ar" CLASS="dd" STYLE="margin-bottom: 4px;"
ONCHANGE="getDropdown(this.form);">
<OPTION VALUE="1">V&auml;lj &aring;r</OPTION>
<%=strYear%>
</SELECT>
</TD>
<TD VALIGN="top" STYLE="padding-left: 16px;"><SPAN
CLASS="bnBorder"><INPUT TYPE="submit" CLASS="bn" VALUE="S&ouml;k"
HIDEFOCUS ID="Submit1" NAME="Submit1"></SPAN></TD>
<TD VALIGN="top" STYLE="padding-left: 16px;"><SPAN
CLASS="bnBorder"><INPUT TYPE="button" CLASS="bn" VALUE="Start"
onClick="goHome();" HIDEFOCUS id=button1 name=button1></SPAN></TD>

<TR>
<TD colspan="2">
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD>&nbsp;</TD>
<TD><B>1</B>&nbsp;Välj tillbehörsgrupp.</TD>
</TR>
<TR>
<TD>&nbsp;</TD>
<TD><B>2</B>&nbsp;Ändra ev. årsmodell. Välj modellgrupp och
modell.</TD>
</TR>
</TABLE>
</TD>
<TD VALIGN="top" STYLE="padding-left: 30px;">
<IFRAME NAME="iframeModelGroup" ID="iframeModelGroup"
SRC="getDropDown.asp?type=modelGroup&make=<%=vchBr and%>" WIDTH="200"
HEIGHT="22" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no"
FRAMEBORDER="0"></IFRAME><BR>
<IFRAME NAME="iframeModelName" ID="iframeModelName"
SRC="getDropDown.asp?type=modelName&make=<%=vchBra nd%>" WIDTH="200"
HEIGHT="20" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no"
FRAMEBORDER="0"></IFRAME>
</TD>
<TD VALIGN="top" STYLE="padding-left: 40px;" colspan=2>
<INPUT TYPE="hidden" CLASS="chk" NAME="pris" value="1"
ID="pris1">&nbsp;<!--b>Visa pris (Inkl. moms)</b-->
</td>
</TR>
</TABLE>
<INPUT TYPE="hidden" NAME="popmodellnamn" VALUE="">
<INPUT TYPE="hidden" NAME="modellnamn" VALUE="">
</FORM>
</DIV>
<div STYLE="position:absolute; right:10; bottom:10; z-index:10;">
<a href="#" onMouseOver="visa()" onMouseOut="dolj()"><img
SRC="imgs/info_icon.gif" ALT BORDER="0"></a>
</table>
</div>
</BODY>
</HTML>

Hope somebody has any ideas!

Thanks in advance!

/David

Sep 14 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a


da*************@hotmail.com wrote:
Error: document.getElementById("folderMenu").cells has no properties
File: http://www.volkswagen.se/tillbehor/js/foldermenu.js
Rad: 49 tmpTab =
document.getElementById("folderMenu").cells[tabNo].childNodes.item(0); <TABLE NAME="folderMenu" ID="folderMenu" BORDER="0" CELLPADDING="0"
CELLSPACING="0" ONSELECTSTART="return false;">


The expression document.getElementById("folderMenu") gives you a HTML
<table> element object which implements the interface specified here:
<http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-64060425>
It has a property named rows which is a collection to access the rows in
the table and for each row you have a cells collection but not for the
table itself.

So correct your script, use some feature checks to avoid errors where
properties are not implemented.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 14 '05 #2

P: n/a
Thanks for your answer! But I still don´t really get it, could you
give me an example of what you mean?

Regards,
David

Sep 14 '05 #3

P: n/a


davkar wrote:
Thanks for your answer! But I still don´t really get it, could you
give me an example of what you mean?


Feature/object detection?
See
<http://jibbering.com/faq/#FAQ4_26>
<http://www.jibbering.com/faq/faq_notes/not_browser_detect.html>

Your example assumes the object returned by that document.getElementById
call has a property named cells which it does not have in Firefox so you
would need to check e.g.
var table = document.getElementById('tableId');
if (table && table.cells) {
// now use table.cells here e.g.
var cell = table.cells[0];
if (cell) {
// now use cell here
}
}

Of course depending on what you want to achieve you might not want to
use table.cells at all but go for some more cross browser way.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 14 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.