Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Place 'random' into a script call


  • From: javascript@xxxxxxxxxx (Greg Krieser)
  • Subject: [Javascript] Place 'random' into a script call
  • Date: Tue, 28 May 2002 22:26:06 -0500

Is it possibe to use a number generated in one Javascript area and place it in another?  Here is what I'd like to do.  Across a site I'd like to call a perl script using this Javascript command.  That works fine and gives me the results I like. 

<script language="JavaScript" src="http://64.41.103.143/cgi-bin/ad/k2fad.cgi?999+F=IMG";></script>

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?

Thanks,

Greg


P.S.  I'm attempting to adapt a banner script to allow flash ads as well as gif and jpg.  The beauty of using JavaScript is that a new random ad is displayed when visitors returns to the page or uses the back button.  Whereas other call methods (and therefore random methods) will simply return the cached image.