dndstef
Oct 4th, 2000, 08:56 AM
I have found a little javascript that expand and collapse on
click on the image but it doesn't work in netscape. I'm unable
to create a click event on an image it won't work.
So on IE when i click on the image the table expand or collapse
and the image change as well a forward img if it is collapsed
end a down img if it is expanded.
I hope some one will be able to help me i'm just beginning with
javascript!
Here is the code i used:
<SCRIPT LANGUAGE="Javascript" RUNAT="client">
function SectionClick (DOMEvent)
{
var parentID;
var child;
var parentImage;
if (standardDOM)
{
parentID = DOMEvent.target.id;
}
else
{
parentID = window.event.srcElement.id;
}
child = document.all ("Subthread-" + parentID);
if (child != null)
{
parentImage = document.all (parentID);
if (child.style.display == "none")
{
child.style.display = "block";
parentImage.src = "images/arcdown.jpg";
parentImage.alt = "Cacher les questions";
}
else
{
child.style.display = "none";
parentImage.src = "images/arcffw.jpg";
parentImage.alt = "Voir les questions";
}
}
return true;
}
</SCRIPT>
<BODY>
<TABLE>
<TR>
<TD>
<IMG SRC="images/arcffw.jpg" ID="1" NAME="1" onclick="SectionClick (event); return false;" />
</TD>
<TD>
<SPAN>Text</SPAN>
</TD>
</TR>
</TABLE><DIV ID="Subthread-1" STYLE="margin-left:0;display:none;">
<TABLE>
<TR>
<TD WIDTH="10">
</TD>
<TD VALIGN="top" ALIGN="RIGHT">
<IMG SRC="images/arcffw.jpg" ID="1.1" NAME="1.1" onclick="SectionClick (event); return false;">
</TD>
<TD WIDTH="80%">
<SPAN>Sub Section 1</SPAN>
</TD>
</TR>
</TABLE><DIV ID="Subthread-1.1" STYLE="margin-left:0;display:none;">
<TABLE>
<TR>
<TD VALIGN="top">
</TD>
<TD VALIGN="top">
</TD>
<TD>
<SPAN>Sub Section 2</SPAN>
</TD>
</TR>
</TABLE></DIV></DIV>
</BODY>
Thanks!
click on the image but it doesn't work in netscape. I'm unable
to create a click event on an image it won't work.
So on IE when i click on the image the table expand or collapse
and the image change as well a forward img if it is collapsed
end a down img if it is expanded.
I hope some one will be able to help me i'm just beginning with
javascript!
Here is the code i used:
<SCRIPT LANGUAGE="Javascript" RUNAT="client">
function SectionClick (DOMEvent)
{
var parentID;
var child;
var parentImage;
if (standardDOM)
{
parentID = DOMEvent.target.id;
}
else
{
parentID = window.event.srcElement.id;
}
child = document.all ("Subthread-" + parentID);
if (child != null)
{
parentImage = document.all (parentID);
if (child.style.display == "none")
{
child.style.display = "block";
parentImage.src = "images/arcdown.jpg";
parentImage.alt = "Cacher les questions";
}
else
{
child.style.display = "none";
parentImage.src = "images/arcffw.jpg";
parentImage.alt = "Voir les questions";
}
}
return true;
}
</SCRIPT>
<BODY>
<TABLE>
<TR>
<TD>
<IMG SRC="images/arcffw.jpg" ID="1" NAME="1" onclick="SectionClick (event); return false;" />
</TD>
<TD>
<SPAN>Text</SPAN>
</TD>
</TR>
</TABLE><DIV ID="Subthread-1" STYLE="margin-left:0;display:none;">
<TABLE>
<TR>
<TD WIDTH="10">
</TD>
<TD VALIGN="top" ALIGN="RIGHT">
<IMG SRC="images/arcffw.jpg" ID="1.1" NAME="1.1" onclick="SectionClick (event); return false;">
</TD>
<TD WIDTH="80%">
<SPAN>Sub Section 1</SPAN>
</TD>
</TR>
</TABLE><DIV ID="Subthread-1.1" STYLE="margin-left:0;display:none;">
<TABLE>
<TR>
<TD VALIGN="top">
</TD>
<TD VALIGN="top">
</TD>
<TD>
<SPAN>Sub Section 2</SPAN>
</TD>
</TR>
</TABLE></DIV></DIV>
</BODY>
Thanks!