...

View Full Version : no images in NS



g00fy
02-24-2003, 03:47 AM
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



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



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 :thumbsup:



kind regards,

g00fy

Graeme Hackston
02-24-2003, 04:14 AM
Which NN? If 4 this might be your problem

http://www.codingforums.com/showthread.php?s=&threadid=3481

g00fy
02-24-2003, 09:19 AM
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


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

Graeme Hackston
02-24-2003, 11:55 PM
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.

ahosang
02-25-2003, 12:50 PM
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.

RoyW
02-25-2003, 04:23 PM
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


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?

g00fy
02-25-2003, 10:43 PM
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 :thumbsup:

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum