[thelist] JS Problem - IE throwing 'null or not an object' error

Robert Vreeland vreeland at studioframework.com
Wed May 14 22:09:29 CDT 2008


Have you tried explicitly setting the inline style on the li element:
li style="display:block"
I seem to recall having a similar problem a few years back that was solved 
by including the style inline to begin with.
----- Original Message ----- 
From: "Blake" <haswell00 at gmail.com>
To: <thelist at lists.evolt.org>
Sent: Wednesday, May 14, 2008 10:40 PM
Subject: [thelist] JS Problem - IE throwing 'null or not an object' error


> Hi List,
>
> I'm having a problem in IE with the following snippets of code.
> Firefox works as expected.
>
> The error in IEs error console says that 'style' is null or not an
> object. From my exploration it seems that the
> getShoppingDescriptions() function is returning an object but it's
> length property is 0, so I assume no LI elements are being found. The
> LIs are not direct descendants of #description, but I don't see why
> that would make a difference because I have a similar situation in
> another script that works fine.
>
> Any ideas?
>
> -- CODE --
>
> // Get the descriptions
> function getShoppingDescriptions() {
> if(document.getElementById('description')) {
> return document.getElementById('description').getElementsByTagName('li');
> }
> else {
> return false;
> }
> }
>
> // Hide all descriptions and display the one you want
> function swapDescriptions(selectedDescription) {
> var description;
> if(description = getShoppingDescriptions()) {
> for(var i = 0; i < description.length; i++) {
> description[i].style.display = 'none';
> }
> description[selectedDescription].style.display = 'block';
> }
> }
> -- 
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt ! 





More information about the thelist mailing list