Announcement

Collapse
No announcement yet.

Css

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Css

    I have 2 sets of link colours defined in actinic.css. This is because some of the site has links on a white background the rest is on a black background.

    I need to apply my 2nd set of links in 2 places.

    one act-navigation_item this is easy I simply apply the class to the link in the template

    two - this is the one I am struggling with, the javascript menu system since i can't wrap this in a class

    this is the js (from advanced user guide)

    <SCRIPT LANGUAGE = JavaScript>
    <!--
    function Recurse(pItem)
    {
    for (var i = 1; i <= pItem.length; i++)
    {
    document.write("<UL>");
    document.write("<LI>");
    document.writeln(pItem[i].sName.link(pItem[i].sURL));
    document.write("</LI>");
    if (pItem[i].pChild)
    {
    Recurse(pItem[i].pChild);
    }
    document.write("</UL>");
    }
    }
    Recurse(section_tree);
    -->
    </SCRIPT>

    #2
    Why not put the "class=abcd" into the JavaScript genrated HTML.

    E.g.

    document.writeln('<div class=myclass>' + pItem[i].sName.link(pItem[i].sURL) + '</div>');

    Not sure if this will affect the link but it's worth trying.

    If that doesn't work you could use JavaScript to replace something right inside the link to get the class into the <a...> tag.

    e.g.

    replace

    pItem[i].sName.link(pItem[i].sURL)


    with

    pItem[i].sName.link(pItem[i].sURL).replace(/href=/i,"class=myclass $1")

    Again not tested but I hope you get the idea.
    Norman
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Hi Norman

      I can't get either piece of code to change my link colours

      The top idea, doesn't pick up my class

      the 2nd idea doesn't pick up the class and loses the link

      Comment


        #4
        Try replacing the wierd but really concise JavaScript (that .link function isn't in my reference):-

        document.writeln(pItem[i].sName.link(pItem[i].sURL));


        With

        document.write('<a href="' + pItem[i].sURL + '">' + pItem[i].sName + '</a>');

        Now you have a more usual type of URL and link that you may be able to add some style into that <a...> tag that's being generated.

        Norman
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Jo

          I have the attached code using CSS and it works fine
          Attached Files
          Owner of a broken heart

          Comment


            #6
            Thanks Guys, I've cracked it

            document.write('<a href="' + pItem[i].sURL + '" class=darkbg>' + pItem[i].sName + '</a>');

            Comment

            Working...
            X