473,390 Members | 1,142 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

Displaying a table with inner HTML

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?
May 5 '07 #1
9 4539
Cogito wrote on 05 mei 2007 in comp.lang.javascript:
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?
Show the shorest working code bits of your code.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
May 5 '07 #2
ASM
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é
May 5 '07 #3
On 05 May 2007 08:28:56 GMT, "Evertjan."
<ex**************@interxnl.netwrote:
>Cogito wrote on 05 mei 2007 in comp.lang.javascript:
>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?

Show the shorest working code bits of your code.
My program solves the "8 Queens problem" (Place 8 queens on chessboard
such that no two attack one another).

The program can be found in the following URL:
http://users.bigpond.net.au/blackbox/8_queens.html

The program works as I designed it. It calculates all solutions at
once. I would like to create another version that displays the first
solution then waits for a click before calculating the second solution
and displaying it on top of the previous solution, i.e., replacing the
previous solution, and so on. I'm not quite sure how to force it to
display something before completion. Ideally, I would like to force a
display of the just calculated solution in the "display" function.

The entire program is my original code except for the inner HTML
method of creating a dynamic table which I have seen in another web
program and emulated. I'm not quite sure how it works and what
stuff.innerHTML+= board;
does.
May 5 '07 #4
On 05 May 2007 08:28:56 GMT, "Evertjan."
<ex**************@interxnl.netwrote:
>Cogito wrote on 05 mei 2007 in comp.lang.javascript:
>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?

Show the shorest working code bits of your code.
Forgot to mention, The program takes some time to calculate all
solutions so please be patient and give it some time...
May 5 '07 #5
Cogito wrote on 06 mei 2007 in comp.lang.javascript:
On 05 May 2007 08:28:56 GMT, "Evertjan."
<ex**************@interxnl.netwrote:
>>Cogito wrote on 05 mei 2007 in comp.lang.javascript:
>>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?

Show the shorest working code bits of your code.

My program solves the "8 Queens problem" (Place 8 queens on chessboard
such that no two attack one another).

The program can be found in the following URL:
http://users.bigpond.net.au/blackbox/8_queens.html

The program works as I designed it. It calculates all solutions at
once. I would like to create another version that displays the first
solution then waits for a click before calculating the second solution
and displaying it on top of the previous solution, i.e., replacing the
previous solution, and so on. I'm not quite sure how to force it to
display something before completion. Ideally, I would like to force a
display of the just calculated solution in the "display" function.

The entire program is my original code except for the inner HTML
method of creating a dynamic table which I have seen in another web
program and emulated. I'm not quite sure how it works and what
stuff.innerHTML+= board;
does.
Why not make a piece of code that shows the problem you are having.

That surely could be done?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
May 5 '07 #6
Cogito wrote:
The entire program is my original code except for the inner HTML
method of creating a dynamic table which I have seen in another web
program and emulated. I'm not quite sure how it works and what
stuff.innerHTML+= board;
does.
Assuming "stuff" is a valid reference to an element, it would assign the
innerHTML plus whatever value "board" has, to the innerHTML of "stuff."

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
May 6 '07 #7
Cogito wrote on 06 mei 2007 in comp.lang.javascript:
On 05 May 2007 08:28:56 GMT, "Evertjan."
<ex**************@interxnl.netwrote:
>>Cogito wrote on 05 mei 2007 in comp.lang.javascript:
>>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?

Show the shorest working code bits of your code.

Forgot to mention, The program takes some time to calculate all
solutions so please be patient and give it some time...
If you stipulate my "shorest" ment "shortest"
that is not a response to my suggestion.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
May 6 '07 #8
On Sun, 06 May 2007 00:38:43 +0200, ASM
<st*********************@wanadoo.fr.invalidwrote :
>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>
Looks good, thanks. I will have a go at incorporating this method into
my program to see if it does the trick for me.
May 6 '07 #9
Cogito wrote:
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?
Being as you can't pause javascript, try changing your solve() function to take two parameters: (startRow, startCol)

Then change

display (solution);

to
display(solution, resumeStartRow, resumeStartCol);
return;

Having calculated where to take up calculations.

In display()

output the grid, and a button below it who's onclick method consists of a call to solve passing the resume row and resume column.
May 6 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: middletree | last post by:
I tried posting this to the SQL Server programming group, but then thought more about it, and thought it was more of an ASP question. If you want the original long description, it's below. But the...
0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
1
by: Eric Adem | last post by:
Try out the following code: <html> <body> <table onMouseOut="alert('out');" width="50%" height="50%" bgcolor=yellow><tr><td> <table width="100%" height="100%"><tr valign=middle> <td...
2
by: steventhrasher42 | last post by:
I can't figure out a way to possibly make this work in HTML. I have a table embedded in another table, with the inner table spanning a few columns. I would like for the outer table to span the...
10
by: tbcarver | last post by:
I have a table that I am trying to add a bottom margin to in IE. I have found that if the table is inside more than 1 div then the shape of the containing div collapses. Please look at this...
10
by: Magnus Warker | last post by:
Hi group! I know that HTML output is not as predictable as sometimes desired, but let me ask a question. The following HTML code produces a rectangle that covers the entire client area of a...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
2
by: =?Utf-8?B?c3R1ZGVudA==?= | last post by:
I am struggling with this asp page. I need to solve this as part of a class project. It is designed to simply read a SQL table and display the data in the browser. But it will only show one record...
10
by: bettyboo | last post by:
Hi all I got some really useful advice from here with my last question so I'm back for more! Only my second post so please bear with me - I'm very new to this so this will probably not be as...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.