Click to See Complete Forum and Search --> : I've got a question...


AdamBrill
01-02-2003, 11:15 PM
Check out the enclosed code. It is a menu, but it has a problem. When you run it, it puts a space in between two of the div tags. What makes it do that? I told it to be 0px high, and then I tried everything that I could think of to try to get rid of the space. Anyone got any ideas? Thanks.

khalidali63
01-02-2003, 11:39 PM
From the looks of it,in your ThItems Array has a value different then all the other values,and that is causing it to not print an element in IE and in NS it overlaps.
Element 4 is not being printed in IE and in NS6 it is under 3 and 5,

here is the actual values in the array as you had

TheItems[3] = new Array(
"0",
"yes",
"text4");

I changed 1 with 0

TheItems[3] = new Array(
"0",
"yes",
"text4");

and seem to a tleast print the way it should be...did not have much time to go through your logic to actually understand it in depth..

:-)

Cheerts

Khalid

AdamBrill
01-03-2003, 07:38 AM
Well, that is actually how it is supposed to be. I knew that it worked like that, but it is going to be a menu, and all of the items aren't supposed to be shown when it first runs. So, the one that had the 1 is supposed to be 0px high so no one can see it. Sorry I didn't explain better in the first place, but I was kind of mad at it at the moment. :) I had gotten the whole thing working that far, then Frontpage locked up, and I had forgotten to save it, so I lost everything. Then I spent the next 2 hr. trying to figure out what I had already had working. :mad:

Let me explain how it works... This line runs if the number is 0:

document.write("<div class='toplevel'>"+TheItems[x][2]+"</div>");

This line runs if the number is 1:

document.write("<div class='secondlevelhidden'>"+TheItems[x][2]+"</div>");

The only difference is the style. That is actually where my problem is coming in. The secondlevelhidden class doesn't work like it is supposed to. If it is that class, I wan't it completely hidden. The problem is actually in the style:

.secondlevelhidden {
height:0px;
line-height:0px;
top:0px;
}

For some weird reason, that won't set it to be 0px high. I guess I should have posted this in the css section of the forums, but I didn't think of it until after I had already posted. :) Thanks.

khalidali63
01-03-2003, 07:46 AM
Well in that case,my guess would be that the do while loop creates an empty spot with no style,where as I'd think what you want is when the value is = 1 that element must not go through any style at all
in this case
instead of loop limit 1 to 6 it should be 1 to 5

?

I think...:-)

Khalid

khalidali63
01-03-2003, 07:54 AM
Ok Adam,
here you go,

in your style sheets code,

.secondlevelhidden

add these 2 properties to the bove class

visibility:hidden;
display:none;

this will take care of your problem


cheers

Khalid

AdamBrill
01-03-2003, 08:01 AM
Thanks a lot, Khalid! I was really stumped on that one... :) Thanks again.