OOPS. I was about to go to bed when I realized I messed up in that last post. Forgot about whitespace issues, so here is the new, improved script:

function styleFirstLI(){ // by divaHTML.com
        var d=document;
        if (!d.getElementsByTagName()) return;
        var zULs=d.getElementsByTagName('ul');
        for (var i=0, len=zULs.length;i<len;i++){
                var li=getNextElement(zULs[i].firstChild);
                li.className='firstLI';
        }
}

function getNextElement(el){
        if (el.nodeType==1) return el;
        if (el.nextSibling) return getNextElement(el.nextSibling);
        return '';
}

 I did not test this, so watch for typos and general tomfoolery.

 Add a class 'firstLI' to your stylesheet.

Put both these functions in an external js script and add this to the head of your page:

<script src="thejsfile.js" type="text/javascript"></script>

 Then call styleFirstLI() on page load, and of course after the ULs have
 been generated by your other scripts.

Sorry for the first bad post.


--

E. Michael Brandt

www.divaHTML.com
divaGPS : you-are-here menu highlighting
divaFAQ : FAQ pages with pizazz

www.valleywebdesigns.com
JustSo PictureWindow
JustSo PhotoAlbum

--

E Michael Brandt wrote:
Given the poor current browser css support for this, perhaps the best thing would be to write a small bit of DOM script that would add a class to that first li for you, on the fly, on page load. It would go something like this:

function styleFirstLI(){ // by divaHTML.com
    var d=document;
    if (!d.getElementsByTagName()) return;
    var zULs=d.getElementsByTagName('ul');
    for (var i=0, len=zULs.length;i<len;i++){
        var li=zULs[i].firstChild;
        li.className='firstLI';
    }
}

Watch for my typos.

Add a class 'firstLI' to your stylesheet.

Then call styleFirstLI() on page load, and of course after the uls have been generated by your other scripts.

Hope that helps.



*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to