[Javascript] Place 'random' into a script call

Colin Cochrane colin at vfs.com
Wed May 29 10:22:39 CDT 2002


>However, I'd like 999 to be a random number each time the page is loaded,
>i.e. :
>
><script LANGUAGE="JavaScript">
>random = parseInt(Math.random()*1000)
></script>
>
>Is it possible to use random in place of the 999 when the script is called?


Sure.


<script LANGUAGE="JavaScript">
random = parseInt(Math.random()*1000)

var url="http://64.41.103.143/cgi-bin/ad/k2fad.cgi?"+random+"+F=IMG";
alert(url);
// alert just for testing purposes, use it wherever you need it.
// ie window.location=url;

</script>

Hope this helps

cdc


Colin Cochrane
Head Instructor
Vancouver Film School New Media
http://www.vfs.com/
Tel: (604) 685-6331 Ext 209
Fax: (604) 685-6308

Vancouver Film School. Creative. Disciplined. Focused.





More information about the Javascript mailing list