Javascript / FireFox help needed

D

DutchMaster11

Can anyone tell me why the following code will work in IE7, but in in
Firefox (or any of its sub-browsers, like Flock)? Click on the link
that says "Alpha Communications / Alpha Media " in red. The Table row
below that one should toggle on/off every time its clicked. In
firefox, however, the TR never goes away and it seems like more TRs
are added the more its clicked... please help!! :)

Thanks!

Dutch






<html>
<head>

<title>Personal Menu</title>

<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">

<STYLE type="text/css">
<!--
INPUT {background-color:#FFFFFF; color:006600; font-
family:tahoma; font-size:9pt;}
SELECT {background-color:#FFFFFF; color:006600; font-
family:tahoma; font-size:9pt; border-style:solid; border-width:1px;
border-color:003300;}
TEXTAREA {background-color:#FFFFFF; color:006600; font-
family:tahoma; font-size:9pt;}
table.ad {background:#eaeaea;border-width: 1px;border-color:
#000000;border-style: solid;}
table.ad000000 {border-width: 1px;border-color: #000000;border-
style: solid;}
table.ad666666 {border-width: 1px;border-color: #666666;border-
style: solid;}
table.ad006600 {border-width: 1px;border-color: #006600;border-
style: solid;}
table.ad660000 {border-width: 1px;border-color: #660000;border-
style: solid;}
table.adFFFFFF {border-width: 1px;border-color: #FFFFFF;border-
style: solid;}
table.adheader {background:#EAFEEB;border-width: 1px;border-
color: #66CC66;border-style: solid;}
table.adheaderhl {background:#FFFFCC;border-width: 1px;border-
color: #66CC66;border-style: solid;}
table.sidebaroption {border-bottom-width: 1px;border-bottom-
color: #cccccc;border-bottom-style: dotted;}
table.sidebaroptionwh {border-bottom-width: 1px;border-bottom-
color: #FFFFFF;border-bottom-style: dotted;}
table.sidebaroption2 {border-bottom-width: 1px;border-bottom-
color: #000000;border-bottom-style: solid;}
table.sidebaroptionhl {background:#F7FFE0;border-bottom-width:
1px;border-bottom-color: #006600;border-bottom-style: solid;}
table.sidebaroptionhl2 {background:#FFFFCC;border-bottom-width:
1px;border-bottom-color: #330000;border-bottom-style: solid;}
.sidebaroptiontext {font-family: Tahoma;font-size: 11px;color:
#003300;}
.sidebaroptiontextbig {font-family: Tahoma;font-size:
13px;color: #009900;}
.bigger {font-family: arial;font-size: 20px;color: #000000;}
.big {font-family: arial;font-size: 14px;color: #000000;}
.reg {font-family: Tahoma;font-size: 12px;color: #000000;}
.header {font-weight:bold;font-family: Arial;font-size:
15px;color: #13529E;}
.small {font-family: tahoma;font-size: 11px;color: #000000;}
.xsmall {font-family: tahoma;font-size: 10px;color: #000000;}
.even{background-color: 006600;}
.odd{background-color: CC0000;}
.even2{background-color: FFFFFF;}
.odd2{background-color: FFFFFF;}
-->
</STYLE>

<script language="JavaScript">
<!--
if (document.images) {
header_dl_over = new Image();
header_dl_over.src = "/images/header_download_over.jpg";
header_dl_off = new Image();
header_dl_off.src = "/images/header_download.jpg";

header_login_over = new Image();
header_login_over.src = "/images/header_login_over.jpg";
header_login_off = new Image();
header_login_off.src = "/images/header_login.jpg";

header_personalmenu_over = new Image();
header_personalmenu_over.src = "/images/
header_personalmenu_over.jpg";
header_personalmenu_off = new Image();
header_personalmenu_off.src = "/images/header_personalmenu.jpg";

header_support_over = new Image();
header_support_over.src = "/images/header_support_over.jpg";
header_support_off = new Image();
header_support_off.src = "/images/header_support.jpg";

menu_home_over = new Image();
menu_home_over.src = "/images/menu_home_over.jpg";
menu_home = new Image();
menu_home.src = "/images/menu_home.jpg";

menu_about_over = new Image();
menu_about_over.src = "/images/menu_about_over.jpg";
menu_about = new Image();
menu_about.src = "/images/menu_about.jpg";

menu_faqs_over = new Image();
menu_faqs_over.src = "/images/menu_faqs_over.jpg";
menu_faqs = new Image();
menu_faqs.src = "/images/menu_faqs.jpg";

menu_support_over = new Image();
menu_support_over.src = "/images/menu_support_over.jpg";
menu_support = new Image();
menu_support.src = "/images/menu_support.jpg";

menu_contact_over = new Image();
menu_contact_over.src = "/images/menu_contact_over.jpg";
menu_contact = new Image();
menu_contact.src = "/images/menu_contact.jpg";

}


function toggleTR(objID) {
var obj = document.getElementById('detail' + objID);
if (obj.style.display == 'block') { obj.style.display = 'none'; }
else { obj.style.display = 'block'; }
}
function changeImages() {
if (document.images) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments].src =
eval(changeImages.arguments[i+1] + ".src");
}
}
}
function openChild(file,window,w,h) {
newWindow=open(file,window,"scrollbars=1,width=" + w + ",height="+
h + "");
if (newWindow.opener == null) newWindow.opener = self;
}
function setFocus(objID) {
var obj = document.getElementById(objID);
obj.focus();
}
function exitToRefresh (snapname)
{
for(var i=0; i < snapname.length; i++ )
{
window.opener.parent.refreshIframe(snapname);
}
window.opener.parent.refreshIframe('chartiframe');
window.opener.location.reload(true);
close ();
}
function exitToURL (url)
{
window.opener.location=url;
close ();
}
function redirect (url)
{
window.location=url;
}
function alternate(id){
var table = document.getElementById("locations");
var rows = table.getElementsByTagName("tr");
for(i = 0; i < rows.length; i=i+2){
if (i==id)
{rows.className = "odd";
rows[i+1].className = "odd2";}
else
{rows.className = "even";
rows[i+1].className = "even2";}
}
}
// -->
</script>

</head>

<body TOPMARGIN=0 BottomMargin=0 LeftMargin=0 RightMargin=0
link="#006600" vlink="#006600" alink="#006600" bgcolor="E2E7F0"
text="#000000">

<script type="text/javascript" src="/wz_tooltip.js"></script>

<CENTER>

<TABLE border=0 bgcolor=ffffff Width=750 Class=ad666666
CellPadding=0 CellSpacing=0>

<TR Height=29>
<TD Colspan=2 class=reg>

</TD>
</TR>
<TR>
<TD colspan=2 Class=reg align=center>
<TABLE cellpadding=2 cellspacing=0 Width=100% border=0>
<TR><TD width=150 valign=top Class=reg align=center>
<BR>
<TABLE cellpadding=0 cellspacing=0 width=140>

<TR><TD colspan=2 Class=reg>

<TABLE
width=140
onMouseOver="this.className='adheaderhl'"
onMouseOut="this.className='adheader'"
Class=adHeader>
<TR><TD Class=reg><B>
<font color=006600>Building Mgrs.</B>
</TD></TR></TABLE>
</TD></TR>
<TR><TD class=reg>
<TABLE cellpadding=0 cellspacing=2
onClick="window.location='http://keith/cgi-bin/site.exe?
Module=addperson&Refresh=140880778&SessionID=sF4eF3tM7t7&Addtype=Manager'"
style="cursor:hand"
width=100%
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'"
Class=sidebaroption>
<TR><TD Class=sidebaroptiontext>

&nbsp;&nbsp;&nbsp;
Add New Building Mgr.
</TD></TR></TABLE>

</TD></TR>
<TR><TD class=reg>
<TABLE cellpadding=0 cellspacing=2
onClick="window.location='http://keith/cgi-bin/site.exe?
Module=personalmenu&Refresh=140880778&action=View&SessionID=sF4eF3tM7t7&Type=manager'"
style="cursor:hand"
width=100%
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'"
Class=sidebaroption>
<TR><TD Class=sidebaroptiontext>
&nbsp;&nbsp;&nbsp;
View my Building Mgrs.
</TD></TR></TABLE>
</TD></TR>
</TABLE>
<BR>
<TABLE cellpadding=0 cellspacing=0 width=140>

<TR><TD colspan=2 Class=reg>
<TABLE
width=140
onMouseOver="this.className='adheaderhl'"
onMouseOut="this.className='adheader'"
Class=adHeader>

<TR><TD Class=reg><B>
<font color=006600>Building Options</B>
</TD></TR></TABLE>
</TD></TR>
<TR><TD class=reg>
<TABLE cellpadding=0 cellspacing=2
onClick="window.location='http://keith/cgi-bin/site.exe?
Module=buildinginformation&Refresh=140880778&action=add&SessionID=sF4eF3tM7t7'"
style="cursor:hand"
width=100%
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'"
Class=sidebaroption>
<TR><TD Class=sidebaroptiontext>

&nbsp;&nbsp;&nbsp;
Add New Building
</TD></TR></TABLE>
</TD></TR>

</TABLE>
<BR>
<TABLE cellpadding=0 cellspacing=0 width=140>
<TR><TD colspan=2 Class=reg>
<TABLE
width=140
onMouseOver="this.className='adheaderhl'"
onMouseOut="this.className='adheader'"
Class=adHeader>
<TR><TD Class=reg><B>
<font color=006600>My Account</B>

</TD></TR></TABLE>
</TD></TR>
<TR><TD class=reg>
<TABLE cellpadding=0 cellspacing=2
onClick="window.location='http://keith/cgi-bin/site.exe?
Module=personalmenu&Refresh=140880778&SessionID=sF4eF3tM7t7'"
style="cursor:hand"
width=100%
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'"
Class=sidebaroption>

<TR><TD Class=sidebaroptiontext>
&nbsp;&nbsp;&nbsp;
My Personal Menu
</TD></TR></TABLE>
</TD></TR>
<TR><TD class=reg>
<TABLE cellpadding=0 cellspacing=2
onClick="window.location='http://keith/cgi-bin/site.exe?
Module=personalinformation&Refresh=140880778&SessionID=sF4eF3tM7t7'"
style="cursor:hand"
width=100%
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'"
Class=sidebaroption>
<TR><TD Class=sidebaroptiontext>

&nbsp;&nbsp;&nbsp;
Edit My Information
</TD></TR></TABLE>
</TD></TR>
<TR><TD class=reg>
<TABLE cellpadding=0 cellspacing=2
onClick="window.location='http://keith/cgi-bin/site.exe?
Module=childaccounts&Refresh=140880778&SessionID=sF4eF3tM7t7'"
style="cursor:hand"
width=100%
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'"
Class=sidebaroption>

<TR><TD Class=sidebaroptiontext>
&nbsp;&nbsp;&nbsp;
Manage Child Accounts
</TD></TR></TABLE>
</TD></TR>
<TR><TD class=reg>
<TABLE cellpadding=0 cellspacing=2
onClick="window.location='http://keith/cgi-bin/site.exe?
Module=changepassword&Refresh=140880778&SessionID=sF4eF3tM7t7'"
style="cursor:hand"
width=100%
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'"
Class=sidebaroption>

<TR><TD Class=sidebaroptiontext>
&nbsp;&nbsp;&nbsp;
Change My Password
</TD></TR></TABLE>
</TD></TR>
<TR><TD class=reg>
<TABLE cellpadding=0 cellspacing=2
onClick="window.location='http://keith/cgi-bin/site.exe?
Module=index&Refresh=140880778&killlogin=Y&sID=sF4eF3tM7t7'"
style="cursor:hand"
width=100%
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'"
Class=sidebaroption>

<TR><TD Class=sidebaroptiontext>
&nbsp;&nbsp;&nbsp;
Logout
</TD></TR></TABLE>
</TD></TR>
</TABLE>

<BR><BR><BR><BR><BR>
</TD><TD width=600 Class=reg valign=top align=center><BR>
<TABLE class=sidebaroption CellPadding=3 CellSpacing=0 Border=0
Width=80%>
<TR>
<TD Class=header align=center>
Personal Menu
<BR><Font class=small>You are logged in as an 'Installer'</font>
</TD>

</TR>
</TABLE>
<BR><BR>
<TABLE class=sidebaroptionwh style="cursor:hand"
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroptionwh'" border=0 iD="tableA0001"
width=80% cellpadding=2 cellspacing=0>
<TR onClick="toggleTR('A0001')"><TD Colspan=2 valign=top
onClick="toggleTR('A0001')">
<TABLE onClick="toggleTR('A0001')" border=0 width=90%
class=sidebaroption cellpadding=1><TR><TD Class=sidebaroptiontextbig
Class=sidebaroptiontextbig>

<font color=660000><B><LI>Alpha Communications / Alpha Media
</TD></TR></TABLE>
</TD></TR>
<TR style="display:none;visibilty:hidden" ID="detailA0001">
<TD Class=sidebaroptiontext valign=top>
<TABLE onClick="openChild('http://maps.yahoo.com/py/maps.py?
Pyt=Tmap&GET%A0Map=Get+Map&addr=42%20Central%20Drive&csz=Farmingdale
%20NY','newone',700,600);" style="cursor:hand"
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'" border=0 width=90%
class=sidebaroption cellpadding=1><TR><TD Class=sidebaroptiontext
align=center>
<B>## User located at:</B><BR><BR>

42 Central Drive<BR>
Farmingdale, NY 11735-1202
<BR>
<font class=small>(Click to view map)</font>

</TD></TR></TABLE>
</TD>
<TD Class=sidebaroptiontext valign=top>
<TABLE onClick="window.location='http://keith/cgi-bin/site.exe?
Module=buildinginformation&Refresh=140880778&action=Edit&SessionID=sF4eF3tM7t7&ID=1'"
style="cursor:hand" onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'" border=0 width=90%
class=sidebaroption cellpadding=1>
<TR><TD width=20 Valign=middle Class=sidebaroptiontext
align=left><IMG src="/images/icon_edit.gif"></TD><TD Valign=middle
Class=sidebaroptiontext align=left><font color=990000><font
color=990000>View / Update Building Information</TD></TR>
</TABLE>

<TABLE border=0 width=90% class=sidebaroption cellpadding=1>
<TR><TD Class=sidebaroptiontext><b>Building Manager:</TD><TD
Class=sidebaroptiontext>Jay Adams</TD></TR>
<TR><TD Class=sidebaroptiontext><b>Installer:</TD><TD
Class=sidebaroptiontext>Keith Maurino</TD></TR>

<TR><TD Class=sidebaroptiontext><b>Sales Partner:</TD><TD
Class=sidebaroptiontext>Jason Goldberg</TD></TR>
</TABLE>
<BR>
</TD>
</TR>
</TABLE>
<BR><BR>
</TD></TR></TABLE>

</TD>
</TR>
</TABLE>

<BR>
<font class=reg>
Copyright © 2007 <A href="http://www.alpha-comm.com/"
Target="new">Alpha Communications</A> and <A href="http://
www.alphamedia.net/" Target="new">Alpha Media, Inc.</A> All Rights
Reserved.
</body>
</html>
 
D

David Mark

DutchMaster11 said:
Can anyone tell me why the following code will work in IE7, but in in
Firefox (or any of its sub-browsers, like Flock)? Click on the link
that says "Alpha Communications / Alpha Media " in red. The Table row
below that one should toggle on/off every time its clicked. In
firefox, however, the TR never goes away and it seems like more TRs
are added the more its clicked... please help!! :)

Thanks!

Dutch
[snip]
<TR onClick="toggleTR('A0001')"><TD Colspan=2 valign=top
onClick="toggleTR('A0001')">
<TABLE onClick="toggleTR('A0001')" border=0 width=90%
class=sidebaroption cellpadding=1><TR><TD Class=sidebaroptiontextbig
Class=sidebaroptiontextbig>

I count three toggleTR calls in onClick (sic) handlers that clearly
overlap. You only need one. I am not surprised that you are getting
odd results.
<font color=660000><B><LI>Alpha Communications / Alpha Media
</TD></TR></TABLE>
</TD></TR>
<TR style="display:none;visibilty:hidden" ID="detailA0001">
<TD Class=sidebaroptiontext valign=top>
<TABLE onClick="openChild('http://maps.yahoo.com/py/maps.py?
Pyt=Tmap&GET%A0Map=Get+Map&addr=42%20Central%20Drive&csz=Farmingdale
%20NY','newone',700,600);" style="cursor:hand"
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'" border=0 width=90%
class=sidebaroption cellpadding=1><TR><TD Class=sidebaroptiontext
align=center>
<B>## User located at:</B><BR><BR>

42 Central Drive<BR>
Farmingdale, NY 11735-1202
<BR>
<font class=small>(Click to view map)</font>

</TD></TR></TABLE>
</TD>
<TD Class=sidebaroptiontext valign=top>
<TABLE onClick="window.location='http://keith/cgi-bin/site.exe?
Module=buildinginformation&Refresh=140880778&action=Edit&SessionID=sF4eF3tM7t7&ID=1'"
style="cursor:hand" onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'" border=0 width=90%
class=sidebaroption cellpadding=1>
<TR><TD width=20 Valign=middle Class=sidebaroptiontext
align=left><IMG src="/images/icon_edit.gif"></TD><TD Valign=middle
Class=sidebaroptiontext align=left><font color=990000><font
color=990000>View / Update Building Information</TD></TR>
</TABLE>

<TABLE border=0 width=90% class=sidebaroption cellpadding=1>
<TR><TD Class=sidebaroptiontext><b>Building Manager:</TD><TD
Class=sidebaroptiontext>Jay Adams</TD></TR>
<TR><TD Class=sidebaroptiontext><b>Installer:</TD><TD
Class=sidebaroptiontext>Keith Maurino</TD></TR>

<TR><TD Class=sidebaroptiontext><b>Sales Partner:</TD><TD
Class=sidebaroptiontext>Jason Goldberg</TD></TR>
</TABLE>
<BR>
</TD>
</TR>
</TABLE>
<BR><BR>
</TD></TR></TABLE>

</TD>
</TR>
</TABLE>

<BR>
<font class=reg>


PS. A font tag with a class name? Tables-in-tables? Consecutive
line breaks? This whole thing is a mess and a maintenance nightmare.
Whoever wrote it needs to start over from scratch, reading a book on
Web authoring first. Adding script to this jumble at this point is
madness.
 
D

DutchMaster11

DutchMaster11 said:
Can anyone tell me why the following code will work in IE7, but in in
Firefox (or any of its sub-browsers, like Flock)? Click on the link
that says "Alpha Communications / Alpha Media " in red. The Table row
below that one should toggle on/off every time its clicked. In
firefox, however, the TR never goes away and it seems like more TRs
are added the more its clicked... please help!! :)

[snip]
<TR onClick="toggleTR('A0001')"><TD Colspan=2 valign=top
onClick="toggleTR('A0001')">
<TABLE onClick="toggleTR('A0001')" border=0 width=90%
class=sidebaroption cellpadding=1><TR><TD Class=sidebaroptiontextbig
Class=sidebaroptiontextbig>

I count three toggleTR calls in onClick (sic) handlers that clearly
overlap. You only need one. I am not surprised that you are getting
odd results.




<font color=660000><B><LI>Alpha Communications / Alpha Media
</TD></TR></TABLE>
</TD></TR>
<TR style="display:none;visibilty:hidden" ID="detailA0001">
<TD Class=sidebaroptiontext valign=top>
<TABLE onClick="openChild('http://maps.yahoo.com/py/maps.py?
Pyt=Tmap&GET%A0Map=Get+Map&addr=42%20Central%20Drive&csz=Farmingdale
%20NY','newone',700,600);" style="cursor:hand"
onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'" border=0 width=90%
class=sidebaroption cellpadding=1><TR><TD Class=sidebaroptiontext
align=center>
<B>## User located at:</B><BR><BR>

42 Central Drive<BR>
Farmingdale, NY 11735-1202
<BR>
<font class=small>(Click to view map)</font>
</TD></TR></TABLE>
</TD>
<TD Class=sidebaroptiontext valign=top>
<TABLE onClick="window.location='http://keith/cgi-bin/site.exe?
Module=buildinginformation&Refresh=140880778&action=Edit&SessionID=sF4eF3tM7t7&ID=1'"
style="cursor:hand" onMouseOver="this.className='sidebaroptionhl'"
onMouseOut="this.className='sidebaroption'" border=0 width=90%
class=sidebaroption cellpadding=1>
<TR><TD width=20 Valign=middle Class=sidebaroptiontext
align=left><IMG src="/images/icon_edit.gif"></TD><TD Valign=middle
Class=sidebaroptiontext align=left><font color=990000><font
color=990000>View / Update Building Information</TD></TR>
</TABLE>
<TABLE border=0 width=90% class=sidebaroption cellpadding=1>
<TR><TD Class=sidebaroptiontext><b>Building Manager:</TD><TD
Class=sidebaroptiontext>Jay Adams</TD></TR>
<TR><TD Class=sidebaroptiontext><b>Installer:</TD><TD
Class=sidebaroptiontext>Keith Maurino</TD></TR>
<TR><TD Class=sidebaroptiontext><b>Sales Partner:</TD><TD
Class=sidebaroptiontext>Jason Goldberg</TD></TR>
</TABLE>
<BR>
</TD>
</TR>
</TABLE>
<BR><BR>
</TD></TR></TABLE>

<BR>
<font class=reg>

PS. A font tag with a class name? Tables-in-tables? Consecutive
line breaks? This whole thing is a mess and a maintenance nightmare.
Whoever wrote it needs to start over from scratch, reading a book on
Web authoring first. Adding script to this jumble at this point is
madness.
Copyright © 2007 <A href="http://www.alpha-comm.com/"
Target="new">Alpha Communications</A> and <A href="http://
www.alphamedia.net/" Target="new">Alpha Media, Inc.</A> All Rights
Reserved.
</body>
</html>


Thanks for your help - I will look into the overlapping onClicks,
however - there were issues getting just one to trigger correctly in
all appropriate areas.

In addition, *I* wrote this - and it is evetremely easy to maintain as
the code is generated by a CGI application. Tables-in-Tables are
perfectly fine as they are designed to be embedded. I've read MANY
books on web authoring, but I only take from them what I find to be
relevant to my own projects. Thanks for your feedback, despite the
fact I never asked.
 
D

DutchMaster11

In addition, removing all but one onClick (I left onClick in the <TR>
containing the inner table) - the same exact thing happens.. the TR
just grows every time its clicked.
 
R

RobG

Can anyone tell me why the following code will work in IE7, but in in
Firefox (or any of its sub-browsers, like Flock)?

I haven't waded through all that code, but it seems that your issue is
with setting a TR's display attribute to 'block'. It is much better
to post a minimal example that shows the error.

In IE the default display property for TR elements is 'block', in
Firefox (and other browsers that have moved beyond CSS 1) it is 'table-
row'. Changing it to block most likely causes the error you
described.

[...]
<STYLE type="text/css">
<!--

HTML comments inside style elements are a waste of time, remove them.

[...]
<script language="JavaScript">

The language attribute is deprecated, type is required.


HTML comments inside script elements are a waste of time, remove them.

[...]
if (document.images) {
header_dl_over = new Image();
header_dl_over.src = "/images/header_download_over.jpg";
header_dl_off = new Image();
header_dl_off.src = "/images/header_download.jpg";

header_login_over = new Image();
header_login_over.src = "/images/header_login_over.jpg";
header_login_off = new Image();
header_login_off.src = "/images/header_login.jpg";

header_personalmenu_over = new Image();
header_personalmenu_over.src = "/images/
header_personalmenu_over.jpg";
header_personalmenu_off = new Image();
header_personalmenu_off.src = "/images/header_personalmenu.jpg";

header_support_over = new Image();
header_support_over.src = "/images/header_support_over.jpg";
header_support_off = new Image();
header_support_off.src = "/images/header_support.jpg";

menu_home_over = new Image();
menu_home_over.src = "/images/menu_home_over.jpg";
menu_home = new Image();
menu_home.src = "/images/menu_home.jpg";

menu_about_over = new Image();
menu_about_over.src = "/images/menu_about_over.jpg";
menu_about = new Image();
menu_about.src = "/images/menu_about.jpg";

menu_faqs_over = new Image();
menu_faqs_over.src = "/images/menu_faqs_over.jpg";
menu_faqs = new Image();
menu_faqs.src = "/images/menu_faqs.jpg";

menu_support_over = new Image();
menu_support_over.src = "/images/menu_support_over.jpg";
menu_support = new Image();
menu_support.src = "/images/menu_support.jpg";

menu_contact_over = new Image();
menu_contact_over.src = "/images/menu_contact_over.jpg";
menu_contact = new Image();
menu_contact.src = "/images/menu_contact.jpg";

}

function toggleTR(objID) {
var obj = document.getElementById('detail' + objID);
if (obj.style.display == 'block') { obj.style.display = 'none'; }
else { obj.style.display = 'block'; }}

Use something like:

obj.style.display = (obj.style.display == 'none')? '' : 'none';


This issue has been discussed many times, search the archives.

function changeImages() {
if (document.images) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments].src =
eval(changeImages.arguments[i+1] + ".src");


eval is very rarely needed:

... = changeImages.arguments[i+1] + ".src";
 
R

RobG

function changeImages() {
if (document.images) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments].src =
eval(changeImages.arguments[i+1] + ".src");


eval is very rarely needed:

... = changeImages.arguments[i+1] + ".src";


Hmm, not paying attention...

... = arguments[i+1] + ".src";
 
T

Thomas 'PointedEars' Lahn

RobG said:
[...]
<STYLE type="text/css">
<!--

HTML comments inside style elements are a waste of time, remove them.

IBTD. The "HTML comment" is merely 7 bytes more to avoid problems with
CSS-unaware UAs, that are sanctioned by the grammar of all CSS specs so
far. It really doesn't hurt, so I still use it in HTML.

http://www.w3.org/TR/CSS2/grammar.html#q2
[...]
<script language="JavaScript"> [...]
<!--

HTML comments inside script elements are a waste of time, remove them.

More, if both markup parsers and script engines would strictly follow
the specs here, those "HTML comments" would be a plain syntax error. As
it proves with Gecko's and IE's when they are "closed" with "-->".
[...]
if (document.images) { ^^^^^^^^^^^^^^^
header_dl_over = new Image();
^^^^^^^^^
There is no obvious relation between those two objects, so that feature
test is flawed. You need to test the former, then use the former; or
better here: test the latter, use the latter.


PointedEars
 
R

Richard Cornford

Thomas said:
RobG said:
[...]
<STYLE type="text/css">
<!--

HTML comments inside style elements are a waste of time, remove
them.

IBTD. The "HTML comment" is merely 7 bytes more to avoid problems
with CSS-unaware UAs, that are sanctioned by the grammar of all
CSS specs so far. It really doesn't hurt, so I still use it in HTML.

But isn't a "CSS-unaware" browser a browser dating from the middle of
the last decade of the last century?
http://www.w3.org/TR/CSS2/grammar.html#q2
[...]
<script language="JavaScript"> [...]
<!--

HTML comments inside script elements are a waste of time,
remove them.

More, if both markup parsers and script engines would strictly
follow the specs here, those "HTML comments" would be a plain
syntax error.
<snip>

The ECMAScript spec allows for syntax extensions in implementations and
'<!--' seems to be universally handled as a syntax extensions; an
alternative for '//' as an marker for the start of an 'end of line'
comment.

But what of your "CSS-unaware" browsers from the mid 1990s? Aren't they
also SCRIPT-unaware, and so rather than have them display the script
text on the page some sort of "script hiding" strategy might be
indicated. ;-)

Richard.
 
T

Thomas 'PointedEars' Lahn

Richard said:
Thomas said:
RobG said:
[...]
<STYLE type="text/css">
<!--
HTML comments inside style elements are a waste of time, remove
them.
IBTD. The "HTML comment" is merely 7 bytes more to avoid problems
with CSS-unaware UAs, that are sanctioned by the grammar of all
CSS specs so far. It really doesn't hurt, so I still use it in HTML.

But isn't a "CSS-unaware" browser a browser dating from the middle of
the last decade of the last century?

You are using those temporal attributes with purpose, however I wrote
"UAs" (user agents), not "browsers", with purpose.
http://www.w3.org/TR/CSS2/grammar.html#q2
[...]
<script language="JavaScript">
[...]
<!--
HTML comments inside script elements are a waste of time,
remove them.
More, if both markup parsers and script engines would strictly
follow the specs here, those "HTML comments" would be a plain
syntax error.
<snip>

The ECMAScript spec allows for syntax extensions in implementations and
'<!--' seems to be universally handled as a syntax extensions; an
alternative for '//' as an marker for the start of an 'end of line'
comment.

True. But I would rather have it *documented* once for *all* ECMAScript
conforming script engines by the language specification itself or by the
respective vendors, and then used, instead of this kind of Voodoo
programming.
But what of your "CSS-unaware" browsers from the mid 1990s? Aren't they
also SCRIPT-unaware, and so rather than have them display the script
text on the page some sort of "script hiding" strategy might be
indicated. ;-)

Not necessarily. CSS dates back from 1996-12-17 (CSS1; but probably not
at least partially implemented before 1997-06 in NN4's JSSS),
client-side scripting in HTML UAs dates back from 1996-03 (JavaScript
1.0 in NN2) :)

It would seem that the comment syntax was included in the CSS grammar
because CSS with its "<" selector is more prone to misinterpretation by
HTML UAs than JS -- or the W3C Style WG had simply given more thought to
backwards compatibility than the ECMA-262 TG.


Regards,
PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top