Announcement

Collapse
No announcement yet.

Random Image when new page opens ...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #46
    Thank you M
    Mash

    Comment


      #47
      The V8 thread for sorting Random images using Norman's scripted can be found at:

      Random Image when new page opens .. that old chest nut
      Mash

      Comment


        #48
        Originally posted by NormanRouxel
        Here's an (untested) idea where you can keep 10 images in Custom Properties. This way you maintain the list of Custom Properties (in Design / Options / Site Defaults) and check "Is File Name" and Actinic will upload and maintain changes for you.
        Code:
        <script language=JavaScript>
        <!--
        var images=new Array('CUSTOMVAR:IMAGE1','CUSTOMVAR:IMAGE2','CUSTOMVAR:IMAGE3','CUSTOMVAR:IMAGE4','CUSTOMVAR:IMAGE5',
                             'CUSTOMVAR:IMAGE6','CUSTOMVAR:IMAGE7','CUSTOMVAR:IMAGE8','CUSTOMVAR:IMAGE9','CUSTOMVAR:IMAGE10');
        document.write('<img width=468 height=60 src="' + images[Math.floor(Math.random()*images.length - 0.01)] + '">');
        //-->
        </script>
        This would also allow you to have a different set of images on different pages by changing these properties for the Section.
        That worked perfectly... until I tried it in IE7 then it threw up a dumb security warning which blocked the script and left an ugly mess on the page. It works fine if you say 'allow script' but a lot of users will probably ignore or reject the error.

        So is there another way of doing this - with PHP maybe?
        John

        Comment


          #49
          Hi I have used in a test site for V8 the same code and it has been excellent, have been concern about being block but the PC I have tried it on has not caused any problems, may be it is my settings.

          I placed it in a fragment. Example of random picture currently only two

          I am also interested in test the script ~ Script posted by Kermy

          To add more dynamic banners, going for a central logo and changing image either side, what i was wondering if it was possible to add a image map to the script instead of the single link. Any ideas would be gratefully recieved, thanks
          Mash

          Comment


            #50
            that's odd, it doesn't give the script warning on your site...?
            John

            Comment


              #51
              On the two PCs here I do not get one, do you?

              That may change when I try out the next banner script, as I said I place the within a fragment to change the large picture on the right.

              M
              Mash

              Comment


                #52
                your site works fine in ie7, but when I tried the script in mine it gave the security error.

                looking at the code the only major difference I see is that your code is in the head section and mine is in the body section...
                John

                Comment


                  #53
                  Yes I place the script in the header and then place the other part in the fragment.

                  Just trying the other script and that is not going very well!
                  Mash

                  Comment


                    #54
                    until I tried it in IE7 then it threw up a dumb security warning which blocked the script
                    Was this in Previewing?

                    If so, there's nothing to worry about as you shouldn't get this warning on a live page.
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment


                      #55
                      oh cool, I'll give it another go then!
                      John

                      Comment


                        #56
                        Hi Guys, using the scrip that Kermy set out in thread #15, wondering if it is possible to add another array to be able place a caption under the banner image which could also have a hyper link?

                        Any ideas would be gratefully recieved, take care M
                        Mash

                        Comment


                          #57
                          I would suggest dropping Kermy a mail on this one.

                          Kind regards,
                          Bruce King
                          SellerDeck

                          Comment


                            #58
                            Originally posted by mash
                            Hi Guys, using the scrip that Kermy set out in thread #15, wondering if it is possible to add another array to be able place a caption under the banner image which could also have a hyper link?
                            Code:
                            function banner(){
                            var banner=[];
                            var link=[];
                            var alt=[];
                            var win=[];
                            var caption=[];
                            
                            banner.push("advert.jpg");
                            link.push("");
                            alt.push("ALT text for shipping image");
                            win.push(false);
                            caption.push("");
                            
                            banner.push("offer.jpg");
                            link.push("http://www.mysite.com/offer.htm");
                            alt.push("ALT text for offer image");
                            win.push(true);
                            caption.push("This is the caption with a <a href='http://www.mysite.com'>link</a>!");
                            
                            var num=Math.floor(Math.random()*(banner.length));
                            var str="<div>";
                            if (link[num]){
                            	str+="<a href=\""+link[num]+"\""+(win[num] ? " target=\"blank\"" : "")+"><img src=\"http://www.mysite.com/"+banner[num]+"\" border=\"0\" alt=\""+alt[num]+"\" /></a>";
                            	}
                            else{
                            	str+="<img src=\"http://www.mysite.com/"+banner[num]+"\" border=\"0\" alt=\""+alt[num]+"\" />";
                            	}
                            str+="</div>"+(caption[num] ? "<div>"+caption[num]+"</div>" : "");
                            return(str);
                            }
                            That will allow you to print out a caption underneath the image.
                            www.gbradley.co.uk
                            Web Development, Actinic Patches, Scripts & more

                            Comment


                              #59
                              Wow, excellent, will test that this evening, thank you will let you know how I get on.

                              Regards Mash
                              Mash

                              Comment


                                #60
                                External javascript

                                Hi,

                                I was wondering if it was possible to place this script from Post #15 in to an external file instead of placing it in the <head> section of the page.

                                Any thoughts would be appreciated, thanks Mash
                                Mash

                                Comment

                                Working...
                                X