neongreen.com > archives > post detail

Wednesday, June 26th, 2002

Created this little diddy for a guy on a newsgroup today. He wanted a pop up window that would only load about once in every ten page views. So I created this script that he could call in the body tag using the 'onload' event.

<script language="JavaScript">
function randomPop() {
//created by craig vanderschaegen 5.26.02
var randomNumber=Math.round((Math.random()*9)+1);
if (randomNumber == 3) {
var url = "http://www.neongreen.com/pop.html";
var winName="randomPop";
window.open(url ,winName,'width=320,height=240')
}
}
</script>

I'm not positive if this is the best way to do this, but I had fun coding it and the guy seemed to be happy with it.

Comments are disabled

RSS 2.0 Feed

flickr