Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding text in a table 1

Status
Not open for further replies.

Tony32

Programmer
Oct 25, 2001
2
US
I'm a mainframe programmer who has just started this week teaching myself ASP and JavaScript. I have been set a small challenge but am struggling!!

I have populated a table from the Access Northwinds database which consists of 11 rows and three columns, but of course it could be any number of rows if it was a different database. My task is that a mouseover event on any column within one row of the table is to reveal additional data in another table. When the mouse moves away the data is to be hidden again. So far I have managed to populate both tables but unable to hide the data in the second table or code the mouseover event.

Any help or advise would be greatly appreciated.

Tony X-)
 
Do you want to hide the whole table?
Just set the display style property.

<TABLE ID=&quot;myTable&quot; STYLE=&quot;display: none&quot;>

then on the mouseover event, make it visible

onmouseover=&quot;myTable.style.display='inline'&quot;

Or

onmouseover=&quot;myTable.style.display='block'&quot;
Mise Le Meas,

Mighty :)
 
Here is an example:

Code:
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<TITLE></TITLE>
<script language=&quot;javascript&quot;>
function show(el,tblcell,txt)
{
	var cel=document.all.item(tblcell);	
	cel.innerText=txt;
};
function hide(el,tblcell)
{
	var cel=document.all.item(tblcell);	
	cel.innerText='';
};
</script>
</HEAD>
<BODY>
<table border=1>
<tr>
	<td>
		<p onmouseover=&quot;show(this,'t1','Your Text');&quot; onmouseout=&quot;hide(this,'t1');&quot; style=&quot;cursor:hand&quot;>George</p>
	</td>
</tr>
</table>
<hr>
<table border=1>
<tr>
	<td>
		<p name=&quot;t1&quot; id=&quot;t1&quot;></p>
	</td>
</tr>
</table>

</BODY>
</HTML>


If u need help please tell me... ________
George, M
 
Sorry I didn't explain myself very well.

Table 1 will consist of a number of rows (this example has 11) with three fields in each row. Table 2 will also consist of the same number of rows with three fields. Each table 1 row will relate directly to the corresponding row in table 2. What I am trying to achieve is that all data in table 2 is to be hidden. When I put the mouseover table 1 on any field within any given row eg row 3 then the data in row 3 on table 2 should be shown and then hidden when the mouse is moved away.

Hope this makes more sense and thanks for the responses so far. What a great site wish I had something like this when I was learning Cobol!!
 
I'm not sure if I'm doing exactly what you want but here goes:

<Script Language=&quot;Javascript&quot;>
<!--
function showIt(layerName)
{
document.getElementById(layerName).style.visibility = &quot;visible&quot;;
}
function hideIt(layerName)
{
document.getElementById(layerName).style.visibility = &quot;hidden&quot;;
}
//-->
</Script>

<Table border=&quot;0&quot;>
<tr>
<td>
<Table border=&quot;1&quot;>
<tr>
<td onMouseOver=&quot;showIt('layera');&quot; onMouseOut=&quot;hideIt('layera');&quot;>
One
<td>
</tr>
<tr>
<td onMouseOver=&quot;showIt('layerb');&quot; onMouseOut=&quot;hideIt('layerb');&quot;>
Two
</td>
</tr>
<tr>
<td onMouseOver=&quot;showIt('layerc');&quot; onMouseOut=&quot;hideIt('layerc');&quot;>
Three
</td>
</tr>
</Table>
</td>
<td>
<Table border=&quot;1&quot;>
<tr>
<td>
<Div id=&quot;layera&quot; STYLE=&quot;VISIBILITY: hidden;&quot;>
A
</Div>
<td>
</tr>
<tr>
<td>
<Div id=&quot;layerb&quot; STYLE=&quot;VISIBILITY: hidden;&quot;>
B
</Div>
</td>
</tr>
<tr>
<td>
<Div id=&quot;layerc&quot; STYLE=&quot;VISIBILITY: hidden;&quot;>
C
</Div>
</td>
</tr>
</Table>
</td>
</tr>
</Table>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top