Hello. I m trying to create an expand/hide button. It would be an image that, when clicked, would either expand or hide a table and change the img src from arrow-up to arrow-down or vice versa. I'm getting an "object expected" error in the following code:
<script type="javascript">
function displ(tblID, that)
{
var showhide;
showhide='';
if (that.src=="images/blackD.gif"); //click on down, show table
{
showhide=='block';
up(that);
}
else
{
showhide=='none';
down(that);
}
showhide='block';
window.document.getElementById(tblID).style.display=showhide;
return true;
}
function up(that)
{
imgU = new Image(); imgU.src = "images/blackU.gif";
that.src=imgU.src;
}
function down(that)
{
imgD = new Image(); imgD.src = "images/blackD.gif";
that.src=imgD.src;
}
</script>
<img src="./images/blackU.gif" alt="" width="12" height="10" border="0" onclick="displ('tbl', this);">
<!--A table with id='tbl'-->
I get the error on the img line, when I'm calling the function. Anyone know why that is? Thanks in advance,
Igor.
<script type="javascript">
function displ(tblID, that)
{
var showhide;
showhide='';
if (that.src=="images/blackD.gif"); //click on down, show table
{
showhide=='block';
up(that);
}
else
{
showhide=='none';
down(that);
}
showhide='block';
window.document.getElementById(tblID).style.display=showhide;
return true;
}
function up(that)
{
imgU = new Image(); imgU.src = "images/blackU.gif";
that.src=imgU.src;
}
function down(that)
{
imgD = new Image(); imgD.src = "images/blackD.gif";
that.src=imgD.src;
}
</script>
<img src="./images/blackU.gif" alt="" width="12" height="10" border="0" onclick="displ('tbl', this);">
<!--A table with id='tbl'-->
I get the error on the img line, when I'm calling the function. Anyone know why that is? Thanks in advance,
Igor.