FlipperBizkut
11-06-2006, 02:53 AM
I have a link with the css attributes:
#foo {
padding: 10px 0 15px 0;
display: none;
}
I have a javascript line that is supposed to look at foo's display property and make a change depending on what it is set at:
document.getElementById(id).style.display = document.getElementById(id).style.display == 'block' ? 'none' : 'block';
It wasn't working as expected (I had to click it twice the first time before it would start working), so I had it alert me to what the display was set at so that I could see what was going on. That alert came back blank. So... apparently, the script is not seeing what foo's display property is set to.
After I click it the first time, the second time it is clicked it works, and the alert comes back and says that it was set to 'none' before it changes it to 'block'. That would be expected according to the script since the script found that #foo was != to 'block' the first time it was clicked (it was blank).
Any idea why this is happening?
#foo {
padding: 10px 0 15px 0;
display: none;
}
I have a javascript line that is supposed to look at foo's display property and make a change depending on what it is set at:
document.getElementById(id).style.display = document.getElementById(id).style.display == 'block' ? 'none' : 'block';
It wasn't working as expected (I had to click it twice the first time before it would start working), so I had it alert me to what the display was set at so that I could see what was going on. That alert came back blank. So... apparently, the script is not seeing what foo's display property is set to.
After I click it the first time, the second time it is clicked it works, and the alert comes back and says that it was set to 'none' before it changes it to 'block'. That would be expected according to the script since the script found that #foo was != to 'block' the first time it was clicked (it was blank).
Any idea why this is happening?