:) there is another method that will retrieve all HTML elements that match a specific HTML tag.
This method is called document.getEle mentsByTagName.
Or you could pass the ID of the table into the JavaScript function.
In that case your JavaScript function would take a parameter: tableID (which is a string containing the ID of the table that you want to hide or display)
For example your JavaScript method would have to be modified to:
And your buttons would look like:
The thing is that you're going to have to figure out whether or not to display the particular table that the function is managing (just check if it's display style is 'none'...if so change it to 'table'...if not change it to 'none').
:)
-Frinny
This method is called document.getEle mentsByTagName.
Or you could pass the ID of the table into the JavaScript function.
In that case your JavaScript function would take a parameter: tableID (which is a string containing the ID of the table that you want to hide or display)
For example your JavaScript method would have to be modified to:
Code:
function HideDisplayTable(tableID){
var tableElement= document.getElementById(tableID);
//.......
}
Code:
<button onclick="displayRow('table1');" >Show table1</button>
<button onclick="displayRow('table2');" >Show table2</button>
Code:
function HideDisplayTable(tableID){
var tableElement= document.getElementById(tableID);
if(tableElement)
{ var hideTable = true;
if(tableElement.style.display == 'none')
{ hideTable = false;}
//.................
}
-Frinny
Comment