HI
Is there a script that will display random pop ups?
Are you talking about a random alert box?
You could use the script at http://javascript.internet.com/messages/rqt-puns.html
as a starting point. You could put the script into a function if you need to call it at a particular point, and change the document.write(quote) to an alert(quote).
If you're talking about a random popup window, this script would accomplish the same thing with some modifications.
HI
I am talking about a pop up window, not a pop up alert box. I will check out that site, but I must tell you I don't know anything about Javascript.
Here it is, modified for a random popup.
<html>
<head>
<title>Random Popup</title>
<script language="JavaScript">
<!--
function openRandom() {
pageURL = new Array
pageURL[0] = "www.dell.com"
pageURL[1] = "www.google.com"
pageURL[2] = "www.yahoo.com"
pageURL[3] = "www.webmonkey.com"
pageURL[4] = "www.sitepoint.com"
pageURL[5] = "www.altavista.com"
pageURL[6] = "www.go.com"
pageURL[7] = "www.cnn.com"
pageURL[8] = "www.news.com"
pageURL[9] = "www.apple.com"
pageURL[10] = "www.ebay.com"
randNum = Math.round(Math.random()*(pageURL.length-1));
var thePage = pageURL[randNum];
popupWin = window.open('http://' + thePage, 'myWindow', 'menubar,toolbar,location,directories,status,scrollbars,resizable,width=640,height=480');
popupWin.focus();
}
// -->
</script>
</head>
<body>
<a href="#" onClick="openRandom();">Random Popup</a>
</body>
</html>
HI
Hey,
You shoudl always use Math.floor() (or Math.ceil), but nto Math.round() for Math.random() and random numbers. Explanation can be found here:
http://javascriptcity.com/forums/sho...?threadid=2366
So, use this:
randNum = Math.floor(Math.random()*(pageURL.length));
aDog
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks