Cogito a écrit :
My program builds several tables using inner HTML. All the tables are
displayed only when the program terminates. How can I make it display
one table at a time and then wait for a click before displaying the
next table?
try to innerHTML each table at its time in same div, no ?
<html>
<script type="text/javascript">
function showHide(what) {
while(what.tagName != 'DIV') what = what.parentNode;
var next = what.id.substring(1)*1+1;
what.className = 'hid';
document.getElementById('d'+next).className = '';
}
onload = function() {
document.getElementById('d1').className = '';
}
</script>
<style type="text/css">
div, table, td { border: 1px solid;}
div.hid { display: none; }
</style>
<div id="d1" class="hid">
<table><tr><td>1</td></tr></table>
<button onclick="showHide(this);">Next</button>
</div>
<div id="d2" class="hid">
<table><tr><td>2</td></tr></table>
<button onclick="showHide(this);">Next</button>
</div>
<div id="d3" class="hid">
<table><tr><td>3</td></tr></table>
<button onclick="showHide(this);">Next</button>
</div>
<div id="d4" class="hid">
<table><tr><td>4</td></tr></table>
<button onclick="showHide(this);">Next</button>
</div>
</html>
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé