Help - Search - Members - Calendar
Full Version: Very Confused!!!
Forums > Resource Center > Webmasters' Corner > Webmasters' Corner Resolved Topics
astrofriends
Okay. This is what's up:
I am image mapping my site menu.
I want one of the links to be a set of rotating links, like everytime you click it, it goes to a different random page off a list or something.
I know that there is a script for ad rotations, where it changes the image and link,
but here, I do not want to change the image, and I want it in the image mapping- is this even possible? Please help!! _unsure.gif
fixtatik
if you're using PHP, you could just apply a simple rotation script. place this anywhere on the page. the best spot is usually at the very top, before any other codes:
CODE
<?php
function randomURL() {
  $urls   = array(
    'http://www.google.com/',
    'http://www.createblog.com/',
    'http://www.myspace.com/'
  );
  $random = rand(0,count($quotes)-1);
  $url    = $urls[$random];
  echo $url;
}
?>

and your image map would look similar to this:
CODE
<img src="LINK IMAGE" alt="" usemap="#imagemap" />
<map id="imagemap">
  <area shape="rect" coords="0,0,0,0" href="<?php randomURL(); ?>" alt="" />
  <area shape="rect" coords="0,0,0,0" href="<?php randomURL(); ?>" alt="" />
</map>
astrofriends
Okay! Thank you very much- this is perfect! It took me a minute to process what you were trying to say, but I understand now. Again, thank you for your help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.