473,383 Members | 1,837 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

slideshow question

Hi
New to javascript. I'm trying to understand how a script at a website I come
across works.
http://www.BRPPISAFETY.COM
Nearly got it but I have changed the variable called 'crossFadeDuration'
to large numbers and small numbers but it doesn't seem to do anything. Could
someone explain what effect changing this variable should bring about and
why don't I see any changes.
many thanks
David

Dec 22 '05 #1
11 2377
it attempts to use Microsoft's proprietary filters (CSS extension) in
MSIE.
Using document.all it detects Explorer, then sets up changing the
image with the filters and starts it, setting up the transformation
duration parameter to the value given. If no MSIE is detected it just
flips images, disregarding all the filters part. But it seems it's
broken.

The piece:

document.images.SlideShow.style.filter="blendTrans (duration=2)";
document.images.SlideShow.style.filter="blendTrans (duration=crossFadeDuration)";

The first line would just set it to 2 seconds, but immediately the
second line overrides the value with string "crossFadeDuration" (as
opposed to value of variable crossFadeDuration).

I bet what the author meant was

document.images.SlideShow.style.filter="blendTrans (duration="+crossFadeDuration+")";

Dec 22 '05 #2

<bw****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
it attempts to use Microsoft's proprietary filters (CSS extension) in
MSIE.
Using document.all it detects Explorer, then sets up changing the
image with the filters and starts it, setting up the transformation
duration parameter to the value given. If no MSIE is detected it just
flips images, disregarding all the filters part. But it seems it's
broken.

The piece:

document.images.SlideShow.style.filter="blendTrans (duration=2)";
document.images.SlideShow.style.filter="blendTrans (duration=crossFadeDuratio
n)";
The first line would just set it to 2 seconds, but immediately the
second line overrides the value with string "crossFadeDuration" (as
opposed to value of variable crossFadeDuration).

I bet what the author meant was

document.images.SlideShow.style.filter="blendTrans (duration="+crossFadeDurat
ion+")";

Thanks for that. I commented out the line that seems to make the the filter
equal to the string "crossFadeDuration" and put your line in. What happens
now is there is no fade between images, it just show one image for 3 seconds
and then suddenly (no fade transition) flips to the other image for 3
seconds and so on. I then put the script back to how the author had it and
commented out the line
document.images.SlideShow.style.filter="blendTrans (duration=2)";
and to my surprise it still has a 2 second fade between one image melting
away and the other fading in! (Each image is on screen for 3 seconds)
Any idea why your answer which looks good doesn't solve the mystery.
Thanks for the help
David

Dec 22 '05 #3

David Graham wrote:
<bw****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
it attempts to use Microsoft's proprietary filters (CSS extension) in
MSIE.
Using document.all it detects Explorer, then sets up changing the
image with the filters and starts it, setting up the transformation
duration parameter to the value given. If no MSIE is detected it just
flips images, disregarding all the filters part. But it seems it's
broken.

The piece:

document.images.SlideShow.style.filter="blendTrans (duration=2)";

document.images.SlideShow.style.filter="blendTrans (duration=crossFadeDuratio
n)";

The first line would just set it to 2 seconds, but immediately the
second line overrides the value with string "crossFadeDuration" (as
opposed to value of variable crossFadeDuration).

I bet what the author meant was

document.images.SlideShow.style.filter="blendTrans (duration="+crossFadeDurat
ion+")";

Thanks for that. I commented out the line that seems to make the the filter
equal to the string "crossFadeDuration" and put your line in. What happens
now is there is no fade between images, it just show one image for 3 seconds
and then suddenly (no fade transition) flips to the other image for 3
seconds and so on. I then put the script back to how the author had it and
commented out the line
document.images.SlideShow.style.filter="blendTrans (duration=2)";
and to my surprise it still has a 2 second fade between one image melting
away and the other fading in! (Each image is on screen for 3 seconds)
Any idea why your answer which looks good doesn't solve the mystery.
Thanks for the help
David


Dec 22 '05 #4

David Graham wrote:
<bw****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
it attempts to use Microsoft's proprietary filters (CSS extension) in
MSIE.
Using document.all it detects Explorer, then sets up changing the
image with the filters and starts it, setting up the transformation
duration parameter to the value given. If no MSIE is detected it just
flips images, disregarding all the filters part. But it seems it's
broken.

The piece:

document.images.SlideShow.style.filter="blendTrans (duration=2)";

document.images.SlideShow.style.filter="blendTrans (duration=crossFadeDuratio
n)";

The first line would just set it to 2 seconds, but immediately the
second line overrides the value with string "crossFadeDuration" (as
opposed to value of variable crossFadeDuration).

I bet what the author meant was

document.images.SlideShow.style.filter="blendTrans (duration="+crossFadeDurat
ion+")";

Thanks for that. I commented out the line that seems to make the the filter
equal to the string "crossFadeDuration" and put your line in. What happens
now is there is no fade between images, it just show one image for 3 seconds
and then suddenly (no fade transition) flips to the other image for 3
seconds and so on. I then put the script back to how the author had it and
commented out the line
document.images.SlideShow.style.filter="blendTrans (duration=2)";
and to my surprise it still has a 2 second fade between one image melting
away and the other fading in! (Each image is on screen for 3 seconds)
Any idea why your answer which looks good doesn't solve the mystery.
Thanks for the help


Sorry about the previous post that got away without any text!

You might be interested in looking at the XML language SMIL which is
designed for media presentations. This language has all sorts of
transitions, fades, etc built in. It requires a player on current
browsers, but it will work on all browsers that have the player
installed. The most recent Real players have nearly full support of W3C
SMIL2 built in, and these player are free to download from Real. There
are other players, some free and some not. Since many people do not
have a player capable of SMIL installed, SMIL often may not be the best
choice for a web page for the masses. However, in a network situation
where you have control of what is installed, it can be a very
attractive solution for media presentations. There is much information
about writing code in SMIL, with many examples, on the Real developer
site.

Dec 22 '05 #5
> it just show one image for 3 seconds and then suddenly (no fade transition) flips to the other image for
3 seconds and so on.
Actually, it starts the transition, but since
var crossFadeDuration = 20;
(20 seconds) and slide changes in 3s, the pic changes -again- long
before the transition becomes somehow visible. crossFadeDuration should
be less than 1000*slideShowSpeed. Either increase one or lower the
other.
I then put the script back to how the author had it and commented out the line


and you deactivated the author's setting custom transition time of 2s
and instead let it fall back to MSIE built-in default of 2s. Same
happens in case of the original script, since text reading
"crossFadeDuration" is not a valid count of time in seconds, it falls
back to default of 2s.
Try changing in the original the "2" to "1" and see if it works faster.
It shouldn't. Then comment out the
"blendTrans(duration=crossFadeDuration)"; line (leaving the "1" above)
and see if it speeds up. It should.

Dec 22 '05 #6

<bw****@gmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
it just show one image for 3 seconds and then suddenly (no fade transition) flips to the other image for 3 seconds and so on.
Actually, it starts the transition, but since
var crossFadeDuration = 20;
(20 seconds) and slide changes in 3s, the pic changes -again- long
before the transition becomes somehow visible. crossFadeDuration should
be less than 1000*slideShowSpeed. Either increase one or lower the
other.
I then put the script back to how the author had it and commented out

the line
and you deactivated the author's setting custom transition time of 2s
and instead let it fall back to MSIE built-in default of 2s. Same
happens in case of the original script, since text reading
"crossFadeDuration" is not a valid count of time in seconds, it falls
back to default of 2s.
Try changing in the original the "2" to "1" and see if it works faster.
It shouldn't. Then comment out the
"blendTrans(duration=crossFadeDuration)"; line (leaving the "1" above)
and see if it speeds up. It should.

Excellent help, it all works like you say.
Many thanks, this was a useful exercise for me.
David
Dec 22 '05 #7

<bw****@gmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
it just show one image for 3 seconds and then suddenly (no fade transition) flips to the other image for 3 seconds and so on.
Actually, it starts the transition, but since
var crossFadeDuration = 20;
(20 seconds) and slide changes in 3s, the pic changes -again- long
before the transition becomes somehow visible. crossFadeDuration should
be less than 1000*slideShowSpeed. Either increase one or lower the
other.
I then put the script back to how the author had it and commented out

the line
and you deactivated the author's setting custom transition time of 2s
and instead let it fall back to MSIE built-in default of 2s. Same
happens in case of the original script, since text reading
"crossFadeDuration" is not a valid count of time in seconds, it falls
back to default of 2s.
Try changing in the original the "2" to "1" and see if it works faster.
It shouldn't. Then comment out the
"blendTrans(duration=crossFadeDuration)"; line (leaving the "1" above)
and see if it speeds up. It should.

One thing I meant to ask was about this code being proprietary for IE. How
do other browsers manage to do a simple swap of the images as an alternative
to the fade transition when they don't know this code?
Dec 22 '05 #8
Noticed the if(document.all) ?
Only MSIE uses document.all (all the others use
gocument.getElementById() ) and so anything contained within this 'if'
is executed only on Explorer. And it's only about transformation, it's
not about -what- gets transformed. The proper image swapping sits
outside the if() so it gets performed by all browsers:

document.images.SlideShow.src = preLoad[j].src;

If you read the HTML, you see:

<td><img SRC="br-01-1.jpg" NAME="SlideShow" height=163 width=250></td>

document.images.SlideShow is the Javascript/DOM object that corresponds
directly to this image tag. They just overwrite its src parameter with
one of predefined ones. If you did
alert(document.images.SlideShow.width), you'd get 250. If you did
document.images.SlideShow.height=300; the image would likely get
stretched vertically, about doubling in height. By doing
document.images.SlideShow.src="http://www.google.com/logos/winter_holiday05_2res.gif";
you'll change the pic to current Google logo by simply changing the src
tag.

Dec 22 '05 #9

bw****@gmail.com wrote:
Noticed the if(document.all) ?
Only MSIE uses document.all (all the others use
gocument.getElementById() ) and so anything contained within this 'if'
is executed only on Explorer.


In fact Opera can use document.all so that it can execute some IE-type
code, but of course the Opera design team prefers getElementById, which
is the current official notation.

Also keep in mind that there are several browsers out there that are
actually only slightly modified IE6, but that have their own name. A
few are Avant, MyIE2, and SBC/Yahoo DSL. Some AOL browsers also are
based on IE6.

Dec 22 '05 #10

<cw******@yahoo.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...

bw****@gmail.com wrote:
Noticed the if(document.all) ?
Only MSIE uses document.all (all the others use
gocument.getElementById() ) and so anything contained within this 'if'
is executed only on Explorer.


In fact Opera can use document.all so that it can execute some IE-type
code, but of course the Opera design team prefers getElementById, which
is the current official notation.

Also keep in mind that there are several browsers out there that are
actually only slightly modified IE6, but that have their own name. A
few are Avant, MyIE2, and SBC/Yahoo DSL. Some AOL browsers also are
based on IE6.

This newsgroup is really good - I have benfited from the knowledge you have
passed on.
David
Dec 22 '05 #11
cw******@yahoo.com said the following on 12/22/2005 4:56 PM:

<snip>
Some AOL browsers also are based on IE6.


The AOL browser isn't based on a specific version of IE, it is a shell
of whatever version IE the user has installed at the time (Windows
only). So, if the user has IE4.0 and AOL9.0, the browser is based on
IE4. IE6.0 and AOL9.0, it is based on IE6.0. Its mostly IE but it has a
few features disabled that IE has, the most prominent would have to be
window.external as you can't script adding a bookmark in AOL.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 23 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tim | last post by:
Hope someone in the big wide world can help... What I want to do is have an image slideshow which automatically scrolls through a series of images very fast, then pauses when you move your mouse...
2
by: Susanna | last post by:
Hi all, I'm using the following slideshow script that I found on the web to display changing images with a crossfade effect. Eventually I will be adding many more images to the slideshow. The...
2
by: Jeannie | last post by:
I have a popup window which is a slideshow of about 7 images. When the popup window loads, the first image is present and then the viewer can select next or previous to scroll through the rest of...
8
by: drillbit_99 | last post by:
I have an HTML page of thumbnail images. Each image can begin a slideshow of the images on the page by clicking on the image. This opens another HTML page that begins the slideshow using large...
1
by: ttamilvanan81 | last post by:
Hai everyone, I need to provide the slideshow for the images. I have upload the images into database. Then i will retrive all the images from the database and provide the slideshow for those...
2
pradeepjain
by: pradeepjain | last post by:
script> // (C) 2000 www.CodeLifter.com // http://www.codelifter.com // Free for all users, but leave in this header // NS4-6,IE4-6 // Fade effect only in IE; degrades gracefully //...
3
by: Gaby Sandoval | last post by:
I have a very simple javascript slideshow. It is extremely basic (see small sample below): <script language="JavaScript1.1"> <!-- //specify interval between slide (in mili seconds) var...
1
by: maarten2002 | last post by:
Hi people, I am quite new to JS-scripting and I have a question. Finally I found a "good" slideshow which works in IE, Chrome, FF with prototype. The only thing is that I would like the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.