Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: random image  (Read 7905 times)

0 Members and 1 Guest are viewing this topic.

steven32collins

    Topic Starter


    Intermediate
    • Experience: Beginner
    • OS: Windows XP
    random image
    « on: April 21, 2010, 02:14:53 AM »
    how can you make it so every time a page loads a random image is displayed out of an array of 2 - 3 but it cannot have a script (unless if you can make it work on signatures on a forum)
    Everything should be made as simple as possible, but not simpler.
    --Albert Einstein--

    steven32collins

      Topic Starter


      Intermediate
      • Experience: Beginner
      • OS: Windows XP
      Re: random image
      « Reply #1 on: April 21, 2010, 02:25:22 AM »
      also this is the script ive got so far and when its inserted onto the webpage its modifyed

      before added to the page

      <script type="text/javascript">
            //Javascript Created by Computerhope
            //store the quotations in arrays
            images = new Array(4);
            images[0] = "<img src='http://www.computerhope.com/banners/banner.gif' />";
            images[1] = "<a href = 'http://www.computerhope.com/history/index.htm'><img src='http://www.computerhope.com/banners/banner2.gif' alt='Computer History'>[/url]";
            images[2] = "<a href = 'http://www.computerhope.com/index.htm'><img src='http://www.computerhope.com/banners/banner3.gif' alt='Visit Computer Hope'>[/url]";
            images[3] = "<a href = 'http://www.computerhope.com/newslet.htm'><img src='http://www.computerhope.com/banners/banner4.gif' alt='Computer Hope Newsletter'>[/url]";
            index = Math.floor(Math.random() * images.length);
      document.write(images[index]);
            //done
             </script>


      after its added to the page

      <div class='signature'> </div>
      &#60;script type="text/javascript">
            //Javascript Created by Computerhope
            //store the quotations in arrays
            images = new Array(4);
            images[0] = "<img src='http://www.computerhope.com/banners/banner.gif' />";
            images[1] = "<a href = 'http://www.computerhope.com/history/index.htm'><img src='http://www.computerhope.com/banners/banner2.gif' alt='Computer History'>[/url]";
            images[2] = "<a href = 'http://www.computerhope.com/index.htm'><img src='http://www.computerhope.com/banners/banner3.gif' alt='Visit Computer Hope'>[/url]";
            images[3] = "<a href = 'http://www.computerhope.com/newslet.htm'><img src='http://www.computerhope.com/banners/banner4.gif' alt='Computer Hope Newsletter'>[/url]";
            index = Math.floor(Math.random() * images.length);
      document.write(images[index]);
            //done
             </script>
      <div> </div>
      Everything should be made as simple as possible, but not simpler.
      --Albert Einstein--

      kpac

      • Web moderator
      • Moderator


      • Hacker

      • kpac®
      • Thanked: 184
        • Yes
        • Yes
        • Yes
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 7
      Re: random image
      « Reply #2 on: April 21, 2010, 10:09:45 AM »
      I don't really understand what you're trying to do.

      steven32collins

        Topic Starter


        Intermediate
        • Experience: Beginner
        • OS: Windows XP
        Re: random image
        « Reply #3 on: April 23, 2010, 02:19:46 AM »
        right i have a couple of signatures i would like a random one to appear each time the page loads

        now ive looked on the website it gave me the first script on my last post but when its inserted onto the forum the < on the script changes to &#60; so then the script wont work please help :)
        Everything should be made as simple as possible, but not simpler.
        --Albert Einstein--

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        Re: random image
        « Reply #4 on: April 23, 2010, 02:28:11 AM »
        right i have a couple of signatures i would like a random one to appear each time the page loads

        now ive looked on the website it gave me the first script on my last post but when its inserted onto the forum the < on the script changes to &#60; so then the script wont work please help :)

        you cannot use scripts on the forum.
        I was trying to dereference Null Pointers before it was cool.

        kpac

        • Web moderator
        • Moderator


        • Hacker

        • kpac®
        • Thanked: 184
          • Yes
          • Yes
          • Yes
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 7
        Re: random image
        « Reply #5 on: April 23, 2010, 10:04:28 AM »
        you cannot use scripts on the forum.
        ...obviously.

        steven32collins

          Topic Starter


          Intermediate
          • Experience: Beginner
          • OS: Windows XP
          Re: random image
          « Reply #6 on: April 23, 2010, 01:44:53 PM »
          well im kinda the guy who built the forum :)

          how can i make it accseptible or work?
          Everything should be made as simple as possible, but not simpler.
          --Albert Einstein--

          kpac

          • Web moderator
          • Moderator


          • Hacker

          • kpac®
          • Thanked: 184
            • Yes
            • Yes
            • Yes
          • Certifications: List
          • Computer: Specs
          • Experience: Expert
          • OS: Windows 7
          Re: random image
          « Reply #7 on: April 23, 2010, 04:02:28 PM »
          What forum are you talking about?

          steven32collins

            Topic Starter


            Intermediate
            • Experience: Beginner
            • OS: Windows XP
            Re: random image
            « Reply #8 on: April 24, 2010, 12:00:23 AM »
            its made by invision power board


            it uses ibf code aswell as html
            Everything should be made as simple as possible, but not simpler.
            --Albert Einstein--

            kpac

            • Web moderator
            • Moderator


            • Hacker

            • kpac®
            • Thanked: 184
              • Yes
              • Yes
              • Yes
            • Certifications: List
            • Computer: Specs
            • Experience: Expert
            • OS: Windows 7
            Re: random image
            « Reply #9 on: April 24, 2010, 02:50:58 AM »
            Well, let me tell you it's not a good idea.

            steven32collins

              Topic Starter


              Intermediate
              • Experience: Beginner
              • OS: Windows XP
              Re: random image
              « Reply #10 on: April 24, 2010, 10:29:35 AM »
              why?
              Everything should be made as simple as possible, but not simpler.
              --Albert Einstein--

              kpac

              • Web moderator
              • Moderator


              • Hacker

              • kpac®
              • Thanked: 184
                • Yes
                • Yes
                • Yes
              • Certifications: List
              • Computer: Specs
              • Experience: Expert
              • OS: Windows 7
              Re: random image
              « Reply #11 on: April 24, 2010, 12:50:35 PM »
              Security. That's the whole idea behind removing the <script> tag from your signature. Anyone or anything could easily get into something they're not supposed to.

              steven32collins

                Topic Starter


                Intermediate
                • Experience: Beginner
                • OS: Windows XP
                Re: random image
                « Reply #12 on: April 24, 2010, 03:35:54 PM »
                ok so how can i do it without the script tag?
                Everything should be made as simple as possible, but not simpler.
                --Albert Einstein--

                steven32collins

                  Topic Starter


                  Intermediate
                  • Experience: Beginner
                  • OS: Windows XP
                  Re: random image
                  « Reply #13 on: April 24, 2010, 03:37:24 PM »
                  what about php?
                  Everything should be made as simple as possible, but not simpler.
                  --Albert Einstein--

                  kpac

                  • Web moderator
                  • Moderator


                  • Hacker

                  • kpac®
                  • Thanked: 184
                    • Yes
                    • Yes
                    • Yes
                  • Certifications: List
                  • Computer: Specs
                  • Experience: Expert
                  • OS: Windows 7
                  Re: random image
                  « Reply #14 on: April 24, 2010, 03:47:20 PM »
                  ok so how can i do it without the script tag?
                  HTML or CSS along cannot display a random image. PHP isn't allowed either.