Alv
12-13-2005, 09:29 PM
Hi,
I have a table with 4 column and on the rightmost column, I am currently displaying a dropdown.
What I would like to do is at a click of a button, the dropdown is hidden and is replaced by an text input in its place.
Part of the code below is from http://www.quirksmode.org/js/blockinvi.html
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function visi(nr)
{
if (document.layers)
{
vista = (document.layers[nr].visibility == 'hide') ? 'show' : 'hide'
document.layers[nr].visibility = vista;
}
else if (document.all)
{
vista = (document.all[nr].style.visibility == 'hidden') ? 'visible' : 'hidden';
document.all[nr].style.visibility = vista;
}
else if (document.getElementById)
{
vista = (document.getElementById(nr).style.visibility == 'hidden') ? 'visible' : 'hidden';
document.getElementById(nr).style.visibility = vista;
}
}
//-->
</SCRIPT>
<STYLE TYPE="text/css">
<!--
.para { visibility: visible; position: relative; }
//-->
</STYLE>
</HEAD>
<BODY>
<TABLE BORDER="1" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
<TR>
<TD WIDTH="25%"> </TD>
<TD WIDTH="25%"> </TD>
<TD WIDTH="25%"> </TD>
<TD WIDTH="25%"><DIV CLASS="para" ID="number1">This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1.
This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1.
This is paragraph 1.</DIV><DIV CLASS="para" ID="number2">This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2.
This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2.
This is paragraph 2.</DIV></TD>
</TR>
</TABLE><BR><BR>
<INPUT TYPE="button" VALUE=" Click " onClick="visi('number1'); return false;">
</BODY>
</HTML>
Would I would like to achieve if for paragraph 2 to reuse the area occupied by paragraph 1 or vice versa on a click on a button. Its as if I have changed the CSS position from relative to absolute.
If I were to change it to absolute, it will not be within the boundary of the table cell, which is something I do not want.
Any help appreciated.
Thank you.
I have a table with 4 column and on the rightmost column, I am currently displaying a dropdown.
What I would like to do is at a click of a button, the dropdown is hidden and is replaced by an text input in its place.
Part of the code below is from http://www.quirksmode.org/js/blockinvi.html
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function visi(nr)
{
if (document.layers)
{
vista = (document.layers[nr].visibility == 'hide') ? 'show' : 'hide'
document.layers[nr].visibility = vista;
}
else if (document.all)
{
vista = (document.all[nr].style.visibility == 'hidden') ? 'visible' : 'hidden';
document.all[nr].style.visibility = vista;
}
else if (document.getElementById)
{
vista = (document.getElementById(nr).style.visibility == 'hidden') ? 'visible' : 'hidden';
document.getElementById(nr).style.visibility = vista;
}
}
//-->
</SCRIPT>
<STYLE TYPE="text/css">
<!--
.para { visibility: visible; position: relative; }
//-->
</STYLE>
</HEAD>
<BODY>
<TABLE BORDER="1" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
<TR>
<TD WIDTH="25%"> </TD>
<TD WIDTH="25%"> </TD>
<TD WIDTH="25%"> </TD>
<TD WIDTH="25%"><DIV CLASS="para" ID="number1">This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1.
This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1. This is paragraph 1.
This is paragraph 1.</DIV><DIV CLASS="para" ID="number2">This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2.
This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2. This is paragraph 2.
This is paragraph 2.</DIV></TD>
</TR>
</TABLE><BR><BR>
<INPUT TYPE="button" VALUE=" Click " onClick="visi('number1'); return false;">
</BODY>
</HTML>
Would I would like to achieve if for paragraph 2 to reuse the area occupied by paragraph 1 or vice versa on a click on a button. Its as if I have changed the CSS position from relative to absolute.
If I were to change it to absolute, it will not be within the boundary of the table cell, which is something I do not want.
Any help appreciated.
Thank you.