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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide/Show Table & Image Swap. 3

Status
Not open for further replies.

TMac42

Programmer
Jul 24, 2000
83
US
I have one table that gets displayed every time a page is refreshed and another two tables below that. I have a + graphic in the first table that allows the user to expand and display the bottom two tables that are wrapped with <DIV> tags. I have an anchor tag wrapped around the image that calls a JS function that basically toggles the display off/on.

So far, the page works well with two exceptions:

1) I want to swap the + image for a - whenever the user clicks on it. Ideally I could build this into my ToggleDisplay function that hides the bottom two tables.

2) When you load or refresh the page, it automatically displays all 3 tables when in reality I want to show just the first one and then have the user determine if the extra tables should be displayed.

Any input is much appreciated.
 

is the animated gif issue still unresolved? the gif isn't the minus or plus gif, right? what exactly does it do...does it pause on mousedown, or it stops completely, never to return?

anyway...as far as the imageX variables being pre-defined...i assume that once you get the DB call, you'll know how many variables you'll need...if so (which should be the case), then you can just create the variables dynamically, based on the number of headers/table sets you have.

let's assume this go around returns 4 headers...

Code:
<script>
hdrNum=4;//number of headers
i=0;
while (i<hdrNum) {
i2=i+1;
eval("imageX"+i2+"='plus"+i2+"';");
i++;
}
</script>

this effectively creates 4 variables (imageX1, imageX2, imageX3 & imageX4) for you to use. of course, the headerNum variable will not be set to 4, it'll be set to the number of header results returned from the DB.

what language are you writing the pages in (for on the fly page construction)...and also, can you post your DB call code?

you're almost there!

- g
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top