View Full Version : Expend Tables
Hi,
I have a nice little script that will expand and colapse tables. For some reason it's not working. Here is the page it is on:
http://www.thehotweb.net/test.php
If you click the +/- signs before each post you will see what I mean.
Here is what it's supposed to look like and how it works:
http://www.thehotweb.net/test2.php
I have it working on the second page but I have no iead what is happening on the first.
Thank You,
Paul
scoutt
12-16-2001, 12:55 PM
in IE on the first test page I get an error.
line: 18
char: 9
error: style.display is null or not an object
url: http://www.thehotweb.net/test.php
Yeah I saw that too. I have no idea why it won't work, it's exactly the same as the second page that I put together. Any ideas on how to fix this?
Thank You,
Paul
_mrkite
12-16-2001, 06:21 PM
Well, you've got problems up the wazoo...first, you've given 15 clickable images the same id, as well as 15 content <div>s. An id is supposed to be unique; that's the whole idea. The browser is putting them in an two arrays - standard procedure - which doesn't help much. Also: there's no such CSS display property as 'show' (NS4 visibility property); the browser is presumably ignoring this and using the default, which is to display the element. Have your PHP generate unique pairs of ids, set initial display to 'none' or skip it, and..
function expandContract() {
var currEl;
for (var currArg=0; currArg<arguments.length; ++currArg) {
currEl = arguments[currArg];
if (currEl && currEl.style) {
if (currEl.style.display == 'none') {
currEl.style.display = '';
} else {
currEl.style.display = 'none';
}
}
}
window.event.cancelBubble = true;
}
onclick="expandContract(p156664e,p156664h)"
This function should 'flip' the display property of whatever elements (ids) you pass it.
Haven't tried it but, looks OK..
Oops didn't notice that all the id feilds were the same, thank you for seening this.
Paul
Ok it still wont work. I have attached the page. Thank you for your help.
Thanks,
Paul
_mrkite
12-18-2001, 12:47 AM
Well, HTML like this isn't helping:
<DIV></DIV>
<DIV id=p1317e></DIV>
and
<DIV></DIV>
<DIV id=p1318h style="DISPLAY: none"></DIV>
[might wanna put some content in there]
I dont know why that happened, those aren't really there. Must of been something when I saved off the page. Here it is again.
Thanks,
Paul
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.