![]() | Welcome to Islandnet.com Locally owned and operated since 1993 |
| Create an Account • Pricing & Features • Domain Registration • Customer Sites • Help & Info | |
Saturday February 11 2012 | |
RandomizeItThis gadget will insert a random line of text from a file into your web page each time it is accessed. These may be simple lines of text, or image tags, or midi clips, or anything else you want to randomize. Let's say you have a page where you need to display the name of a vegetable at random. The first thing we need to do is create a text file containing all the possible choices. The very first line of this file must be a number, indicating how many choices follow. After the first line, each subsequent line represents a single choice. For example:
5 carrot turnip potato radish cabbageAt the point in your web page where you want a random vegetable name to appear, include this tag:
<!--#exec cgi="/cgi-bin/randomizeit?login=LOGIN&file=FILE" -->Replace LOGIN with your Islandnet login. You may not use an alias here. Replace FILE with the name of the file. This is relative to your root directory. This gadget assumes that your text file ends with a ".rnd" extension. For example, if the sample file above was named "veggies.rnd" and was located in your "www" directory, you would replace FILE with "www/veggies" (note you do not include the filename extension). But wait - what if we want a random picture of a vegetable to appear? Easy... Using the same example as above, we simply need to change the "veggies.rnd" file to look something like this:
5 <img src="carrot.gif"> <img src="turnip.gif"> <img src="potato.gif"> <img src="radish.gif"> <img src="cabbage.gif"> |
| Home • About Us • Contact Us • Terms of Use • Privacy Policy • Help Documents |
| Page generation time: 0.01 seconds |