random numbers undefined?

wxdqz

New Member
Okay. I may be being stupid here, but this script (designed to fill my weblog with random sites, natch) dosen't seem to work at all. The idea is to construct an IP address by combining 4 random numbers as the variable generatedIP, but the numbers aren't generating at all.

This originally used an array of about 50 sites and flicked randomly through the list just fine.

The random numbers seem to be the problem as they are permanantly undefined - what am i missing? also, is there any way to generate a random number that is already a string, since i'll probably have to turn them into strings to combine them like i want to.

And yes, i realise it's the most useless piece of js ever wrote.

...

<HTML>
<HEAD>
<META HTTP-EQUIV=Refresh CONTENT="10">

<SCRIPT LANGUAGE="JavaScript">

var generatedIP;
var a = math.floor(math.random()*255); //a.#.#.#
var b = math.floor(math.random()*255); //#.b.#.#
var c = math.floor(math.random()*255); //#.#.c.#
var d = math.floor(math.random()*255); //#.#.#.d
var z = math.floor((math.random()*4)*2000); //random interval

generatedIP = a+"."+b+"."+c+"."+d; //generated IP address

function logSpoof() {
self.setTimeout("targetframe.location.href = generatedIP;",z);
}

// End -->
</SCRIPT>
</HEAD>

<BODY onLoad=logSpoof()>
<IFRAME name=targetframe height=90% width=90% align="center">
</IFRAME>
<P align=center>Please Wait...</P>
</BODY>
</HTML>
 
Top