Thank you M
Announcement
Collapse
No announcement yet.
Random Image when new page opens ...
Collapse
X
-
The V8 thread for sorting Random images using Norman's scripted can be found at:
Random Image when new page opens .. that old chest nutMash
Comment
-
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.Originally posted by NormanRouxelHere'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.This would also allow you to have a different set of images on different pages by changing these properties for the Section.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>
So is there another way of doing this - with PHP maybe?John
Comment
-
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, thanksMash
Comment
-
Was this in Previewing?until I tried it in IE7 then it threw up a dumb security warning which blocked the script
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
-
Originally posted by mashHi 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?That will allow you to print out a caption underneath the image.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); }www.gbradley.co.uk
Web Development, Actinic Patches, Scripts & more
Comment
Comment