1 Reply Latest reply on Sep 24, 2008 7:10 AM by Newsgroup_User

    alt tags on Javascript

    russell_van_gravy Level 1
      Hi I have a random image javascript generator but I need to get each image to have an alt tag (the same for each image is fine). Can anybody help please

      my code is attached:
        • 1. Re: alt tags on Javascript
          Level 7
          Change this -

          <script language="JavaScript">

          to this -

          <script type="text/javascript">

          and this -

          document.write("' border='0' />");

          to this -

          document.write("' border='0' alt='whatever' />");


          --
          Murray --- ICQ 71997575
          Adobe Community Expert
          (If you *MUST* email me, don't LAUGH when you do so!)
          ==================
          http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
          http://www.dwfaq.com - DW FAQs, Tutorials & Resources
          ==================


          "russell van gravy" <webforumsuser@macromedia.com> wrote in message
          news:gbdf3p$jcd$1@forums.macromedia.com...
          > Hi I have a random image javascript generator but I need to get each image
          > to
          > have an alt tag (the same for each image is fine). Can anybody help please
          >
          > my code is attached:
          >
          >
          > <script language="JavaScript">
          >
          > // Drummy's Random Image Script
          > // (C) 2006 Paul Voth, Drummy.org
          > // Please leave this copyright notice
          > // In the script if you're gonna use it :)
          >
          > function get_random()
          > {
          >
          > // Make sure that random()*X) has the correct
          > // number. The number of images defined below.
          > var ranNum= Math.floor(Math.random()*5);
          > return ranNum;
          > }
          > var whichImg=get_random();
          >
          > function show_image() {
          >
          > // Add your images here.
          > // Make sure that Array(X) has the number
          > // of images that you want to include
          > var img=new Array(5)
          > img[0]=" http://www.eurocell.co.uk/img1.jpg";
          > img[1]=" http://www.eurocell.co.uk/img2.jpg";
          > img[2]=" http://www.eurocell.co.uk/img3.jpg";
          > img[3]=" http://www.eurocell.co.uk/img4.jpg";
          > img[4]=" http://www.eurocell.co.uk/img5.jpg";
          > // Here the actual displaying of the image is taking place.
          > document.write("<img src='");
          > document.write(img[whichImg]);
          > document.write("' border='0' />");
          > }
          > </script>
          >