Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Wouldn't switching the body's css class also work and make it all more maintainable? :)

    Ordinary morality is for ordinary people. -- Aleister Crowley
    • Yes, ofcourse it would.. It's one of those TIMTOWTDI thingies :)
      • It’s not TMTOWTDI… it’s a matter of, as Larry likes to say, baby talk. What you did is a way to do it, but really it’s not a very good way. Switching the body class is one thing you should really do; the other is unobtrusive scripting []. Another thing is that you want to hide these links from people who don’t have Javascript in the first place.


        <style type="text/css">
        body { /* ... */ }
        body.with-bg { /* ... */ }
        #toggle-bg b { font-weight: normal }
        body.with-bg #toggle-bg .plus  { display: none }
        body.with-bg #toggle-bg .minus { display: inline }
        body         #toggle-bg .minus { display: none }

        <script type="text/javascript" language="javascript"
        src=" n.js"></script>
        <script type="text/javascript">
        jQuery( function() {
                .append( '<a href="#"><b class="plus">[+]</b><b class="minus">[-]</b></a>' )
                .find( 'a' )
                .click( function() { $('body').toggleClass('with-bg'); return false } );
        } );

        <body class="with-bg">
        <div id="toggle-bg"></div>
        • Err, s/jQuery/\$/.

          • I can still remember those ugly times of NN4, where we still had to assume people who don't have JS on, might also have CSS off. The days really got better in this regard.

            Ordinary morality is for ordinary people. -- Aleister Crowley