Results 1 to 2 of 2

Thread: Script not working on IE or Edge, but works in Chrome and Firefox

  1. #1
    Join Date
    Nov 2018
    Location
    Marietta, OH
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Script not working on IE or Edge, but works in Chrome and Firefox

    1) Script Title: randompic.js

    2) Script URL (on DD): This is from a third party that used a DD script but I don't know the URL

    3) Describe problem: Script is below. As I put in the title - not working in IE or Edge, but works in Chrome and Firefox. My system is windows10 pro with ie11, Edge 25.10586.0
    Code:
    picList = new Array(
            "images/banner/Specials2.jpg",
            "images/banner/Specials5.jpg",
            "images/banner/Specials3.jpg",
            "images/banner/Specials7.jpg",
            "images/banner/Specials4.jpg",
            "images/banner/Specials1.jpg",
    	);
    
    altList = new Array(
    	"Milwaukee Promotion",
    	"Kenwood Promotion",
    	"GearWrench Promotion",
    	"Motorola Promotion",
    	"3M Promotion",
    	"3M Fall Protection Promotion",
    	);
    
    linkList = new Array(
    	"content/Milwaukee%20P4%202018.pdf",
    	"content/Kenwood%20Q4%202018.pdf",
    	"content/GearWrench%20Q3%202018.pdf",
    	"content/Motorola%20Q3%202018.pdf",
    	"http://samples.zift123.com/?aa=3m.ziftsolutions.com&wid=ff80818164821e2601648ae643501315",
    	"content/3M%20Q2%202018.pdf",
    	);
    
    
    imgCt = picList.length;
    
    function choosePic() {
    	if (document.images) {
                    // choose first pic randomly 
    		randomNum = Math.floor((Math.random() * imgCt));
    		document.randPic.src = picList[randomNum];
    		document.randPic.alt = altList[randomNum];
    
                    // rotate pic every 20 seconds
                    setTimeout("choosePic()", 5 * 1000); 
    	}
    }
    
    //Fade-in image slideshow- By Dynamic Drive
    //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
    //This credit MUST stay intact for use
    
    var slideshow_width='292px' //SET IMAGE WIDTH
    var slideshow_height='380px' //SET IMAGE HEIGHT
    var pause=5000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
    
    ////NO need to edit beyond here/////////////
    
    var preloadedimages=new Array()
    for (p=0;p<picList.length;p++){
    preloadedimages[p]=new Image()
    preloadedimages[p].src=picList[p]
    }
    
    var ie4=document.all
    var dom=document.getElementById
    
    if (ie4||dom)
    document.write('<div style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div  id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div></div>')
    else
    document.write('<a title="'+altList[0]+'" target="_blank" href=\''+linkList[0]+'\'"><img name="defaultslide" src="'+picList[0]+'" alt="'+altList[0]+'"></a>')
    
    var curpos=10
    var degree=10
    var curcanvas="canvas0"
    var curimageindex=0
    var nextimageindex=1
    
    
    function fadepic(){
    if (curpos<100){
    curpos+=10
    if (tempobj.filters)
    tempobj.filters.alpha.opacity=curpos
    else if (tempobj.style.MozOpacity)
    tempobj.style.MozOpacity=curpos/100
    }
    else{
    clearInterval(dropslide)
    nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
    tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
    tempobj.innerHTML='<a title="'+altList[nextimageindex]+'" target="_blank" href=\''+linkList[nextimageindex]+'\'"><img src="'+picList[nextimageindex]+'" alt="'+altList[nextimageindex]+'"></a>'
    nextimageindex=(nextimageindex<picList.length-1)? nextimageindex+1 : 0
    setTimeout("rotateimage()",pause)
    }
    }
    
    function rotateimage(){
    if (ie4||dom){
    resetit(curcanvas)
    var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
    crossobj.style.zIndex++
    var temp='setInterval("fadepic()",50)'
    dropslide=eval(temp)
    curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
    }
    else
    document.images.defaultslide.src=picList[curimageindex]
    curimageindex=(curimageindex<picList.length-1)? curimageindex+1 : 0
    }
    
    function resetit(what){
    curpos=10
    var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
    if (crossobj.filters)
    crossobj.filters.alpha.opacity=curpos
    else if (crossobj.style.MozOpacity)
    crossobj.style.MozOpacity=curpos/100
    }
    
    function startit(){
    var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
    crossobj.innerHTML='<a title="'+altList[curimageindex]+'" target="_blank" href=\''+linkList[curimageindex]+'\'"><img src="'+picList[curimageindex]+'" alt="'+altList[curimageindex]+'"></a>'
    rotateimage()
    }
    
    if (ie4||dom)
    window.onload=startit
    else
    setInterval("rotateimage()",pause)
    
    <!-- ************ fade in / out rotation of pictures end ********* -->
    Last edited by keyboard; 11-19-2018 at 12:52 PM. Reason: Format: Code Tags

  2. #2
    Join Date
    Nov 2018
    Location
    Marietta, OH
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I figured out what was causing the issue.

    Extra commas behind the last entry in each of the Lists.

Similar Threads

  1. Replies: 3
    Last Post: 09-12-2013, 12:11 AM
  2. Replies: 1
    Last Post: 02-21-2013, 04:32 AM
  3. DD Tab Menu works with IE7/8, not with Firefox, Safari and Chrome.
    By vmehta in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 03-27-2011, 04:45 PM
  4. Ultimate Fade-in slideshow works on IE but not on Chrome or Firefox
    By raydona in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 10-11-2010, 02:54 PM
  5. Replies: 0
    Last Post: 08-11-2009, 09:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •