This simple and handy jQuery filter return a single random item from a selection of items. Credit to Waldek Mastykarz.
JS - jQuery
Usage:
$('item:random').text();
jQuery.jQueryRandom = 0; jQuery.extend(jQuery.expr[":"], { random: function(a, i, m, r) { if (i == 0) { jQuery.jQueryRandom = Math.floor(Math.random() * r.length); }; return i == jQuery.jQueryRandom; } });
Comments will be moderated and
rel="nofollow"
will be added to all links. You can wrap your coding with[code][/code]
to make use of built-in syntax highlighter.