Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Free Nodelet Hack: Display a "fortune" string

by jdporter (Paladin)
on Aug 14, 2006 at 17:03 UTC ( [id://567284]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Optional vote explanation box as an anonymous message sender.
in thread Optional vote explanation box as an anonymous message sender.

I love those funny quotes. I thought it would be cool to have one of them displayed on every PerlMonks page.

So I came up with the following Free Nodelet Hack, which displays a string, chosen at random from a list. If you integrate this with your Free Nodelet, then each time a page is loaded one of the fortunes is displayed in the nodelet. (Actually, the <p id="fortune_p"></p> could be anywhere, such as in your Personal Nodelet.)

<p id="fortune_p"></p> <script type="text/javascript"> <!-- var fortunes = new Array( "Abandon desire", "Abandon normal instruct +ions", "Accept advice" ); // etc. var p = document.getElementById('fortune_p'); var txt = document.createTextNode( fortunes[ Math.floor( Math.rando +m() * fortunes.length ) ] ); p.appendChild(txt); // --> </script>
We're building the house of the future together.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://567284]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-26 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found