uga2000dave Posted December 27, 2003 Posted December 27, 2003 Anybody know if the Random HTML Generator provided via CPanel works w/ imagemaps? I wanted to have a random header appear each time the page was refreshed. The coordinates for the hotspots are the same on every image so the imagemap reference doesn't change. Thanks DAve Quote
TCH-Don Posted January 2, 2004 Posted January 2, 2004 As I understand it the Random HTML script allows you to insert random pieces of text into your web page such as quotes, I believe you can use a line of html to display an image but not an image map. there must be a javascript or php code to do this. other wise maybe a php script to include random code (image map and code) google may help to find something like *http://www.alistapart.com/articles/randomizer/ or something similar or a random map location in the image map html. Sorry thats all I could find. Quote
glassgorilla Posted January 2, 2004 Posted January 2, 2004 I don't know if it specifically works about the random html generator, but it can be easily done in php with ease.. 1. rename whatever file this is happening on to have a .php extension (i.e. index.html -> index.php) 2. put this where you want the image map to appear: ><? include ('randommap.php'); ?> 3. create a text file called randommap.php 4. make the text of the file this: ><? $imgmap = rand(1,3); if($imgmap == 1) { ?> //the code of your first map here <img src="http://lightsphere.com/dev/ismaps/cube.gif" alt="" usemap="#cube"> <map name="cube"> <area shape="rect" coords="1,1,37,37" href="http://www.google.com"> <area shape="rect" coords="37,1,74,37" href="http://www.yahoo.com"> <area shape="rect" coords="1,37,37,74" href="http://www.nfl.com"> <area shape="rect" coords="37,37,74,74" href="http://www.totalchoicehosting.com"> </map> <? } if($imgmap == 2) { ?> //the code of your second map here <? } if($imgmap == 3) { ?> //the code to your third map here <? } ?> 5. upload it to the same directory... now you could have the above in the file you want this map to appear, but it may get a little messy to look at which is why i would put it in the randommap.php file 6. if this map appears on several pages, all you have to do is put the first snippet (the include('randommap.php') snippet) on any page at the place you want the map to appear. 7. the rand(1,3) line can be changed so you can add as many maps as you have. this example would have three... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.