Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: no images in NS

  1. #1
    New Coder
    Join Date
    Jan 2003
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    no images in NS

    hi to all,

    this is my anser to my earlier post and a totally different prob, so i reposted - hope thats OK ?

    this is my attempt at a slideshow that is crossbrowser with buttons and timed transition

    it works fine in IE but i get no images in NS, although the text does change correctly

    this is my code, i give you the lot so you can see wotz goin on, the prob is obviously in the browser detection in the show() method

    Code:
    var halt          = false;  // true if show stopped
    var backward      = false;  // true when going back through gallery
    var activeTimeout = false; 
    var delay         = 10000;  // image delay (millisec)
    var transition    = 3;      // transition time (sec)
    
    // array ot hold images
    var imgObjects   = new Array("images/next.gif", 
                                 "images/next_over.gif", 
                                 "images/pause.gif", 
                                "images/pause_over.gif", 
                                "images/previous.gif", 
                                "images/previous_over.gif");							 
    var imageArray   = new Array();
    
    // array to hold the corresponding images comments :)
    var commentArray = new Array("this is the first picture's comment", "this is another picture", 
                      "and yet another picture", 
                      "guess what? here is another",
                      "and another one",
                      "and finally the last one");
    
    // the original image and comment from he html page 
    var img1        = new Image();
    img1.src        = "images/next.gif";
    var origMessage = "this is the title page image";
    
    // browser detection
    var ie4=document.all
    var ns4=document.layers
    var ns6=document.getElementById&&!document.all
    
    //
    
    var a;
    var imageNum = 0;
    var last = imgObjects.length-1;
    
    var preLoad = new Array();
    for (i = 1; i < last + 1; i++){
    preLoad[i] = new Image();
    preLoad[i].src = imgObjects[i];}
    
    function show(whichWay){
      
    	if (whichWay == "start"){
    	  document.images.SlideShow.src = img1.src;
    		
    	if (document.getElementById){ 
    		  document.getElementById("gallery").src= img1.src;
    		  document.getElementById("comment").innerHTML= origMessage;
    	}
    	  halt = true;
    	  if (activeTimeout)
    		clearTimeout(activeTimeout);
    	  backward = false;
    	}
    	
    	if (whichWay == "next"){ 
    	  imageNum = imageNum + 1;
    	  halt = false;
    	  if (activeTimeout)
    		clearTimeout(activeTimeout);
    	  backward = false;
    	}
    	
    	if (whichWay == "prev"){
    	  imageNum = imageNum - 1;
    	  halt = false;
    	  if (activeTimeout)
    		clearTimeout(activeTimeout);
    	  backward = true;
    	}
    	
    	if (whichWay == "stop"){
    	  imageNum = imageNum;
    	  halt = true;
    	  if (activeTimeout)
    		clearTimeout(activeTimeout);
    	  backward = false;
    	}
    	
    	if (imageNum > (last)) 
    	  imageNum = 1;
    	if (imageNum < 1) 
    	  imageNum = last;
    this is where the problem is

    Code:
    if (!halt){	 
    		if (ie4){
    		  document.images.SlideShow.style.filter="blendTrans(duration=2)";
    		  document.images.SlideShow.style.filter="blendTrans(duration=transition)";
    		  document.images.SlideShow.filters.blendTrans.Apply();
    		}
    		document.images.SlideShow.src = preLoad[imageNum].src;
    		
    		if(ns4){
    		  document.gallery.visibility = "show";
    		  document.getElementById("gallery").src= imageArray[imageNum];
    		  document.getElementById("comment").innerHTML= commentArray[imageNum];
    		}		  
    		
    		if (ns6){ 
    		  document.getElementById("gallery").src= imageArray[imageNum];
    		  document.getElementById("comment").innerHTML= commentArray[imageNum];
    		}
    		
    		if (ie4) 
    		  document.images.SlideShow.filters.blendTrans.Play();
    	  
    		activeTimeout = setTimeout("show('next');activeTimeout=false", delay);
    	}
    }
    thanx to all,

    i think after spending hours reading through the posts i might actually be getting somewhere



    kind regards,

    g00fy
    Last edited by g00fy; 02-24-2003 at 03:50 AM.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    624
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Which NN? If 4 this might be your problem

    NN4 needs different relative paths?

  • #3
    New Coder
    Join Date
    Jan 2003
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ns7 actually,

    i only have ns, mozilla and ie6 installed,

    the images & text only work in ie

    and only the text works in ns / mozilla


    i looked at that article but from what i can gather, its for framed pages,

    ** does this also apply to a div layer?

    thats y i included the line
    Code:
    document.gallery.visibility = "show";
    i know its coded for ns4 but if i include it for ns6 nothing works
    and i dont have ns4 to test, but i assume its the same as ns6

    but as far as that im lost



    regards,

    g00fy
    Last edited by g00fy; 02-24-2003 at 09:22 AM.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    624
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I didn't know which NN you were having problems with. That problem is specific to NN4 regarding relative paths.

    Sorry nothing jumps out at me that would mess up NN6+. maybe someone else will see something.

  • #5
    Regular Coder
    Join Date
    Sep 2002
    Location
    Surrey, UK
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It seems the coding is a bit haphazard. I can't tell what is what without the HTML code, but here's a little tips:
    if (ns6){
    document.getElementById("gallery").src= imageArray[imageNum];
    document.getElementById("comment").innerHTML= commentArray[imageNum];
    }
    COULD BE:

    if (ns6){
    document.images["gallery"].style.visibility = "show";
    document.images["gallery"].src= imageArray[imageNum];// this is a simple x-browser way to reference images
    document.getElementById("comment").innerHTML= commentArray[imageNum];
    }
    I don't see where the array imageArray is being populated in your code!

    It's really a bit confusing without seeing your code.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    Atlanta, GA.
    Posts
    313
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think you need to post a test page including the HTML.

    Some things I noticed.
    document.images.SlideShow.src = img1.src;

    document.getElementById("gallery").src= img1.src;

    So what is your image called. Is it "SlideShow" or is it "gallery"

    Also
    Code:
    if(ns4){
      document.gallery.visibility = "show";
      document.getElementById("gallery").src= imageArray[imageNum];
      document.getElementById("comment").innerHTML= commentArray[imageNum];
    }
    Will not work because NS4 does not support document.getElementById or innerHTML.

    Also,
    is document.gallery a Layer or an Image?

  • #7
    New Coder
    Join Date
    Jan 2003
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok sorry guys,

    here is the files required for this to actually work, i prefer to have my scripts in external files where possible,

    gallery is a div and
    SlideShow is an image in the div

    thanx to all who are trying to help me

    BTW i have changed it a little from first post, and the click.js is just a no right click script

    ALSO, this page is loaded into an iframe within the main page of the site, dont know if this affects performance of the gallery script or not ?

    will eventually be using frames anyway


    kind regards,

    g00fy
    Attached Files Attached Files


  •  

    Posting Permissions

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