[Javascript] Trying to get this code to work
GH
GaryHotko at gmail.com
Sat Sep 25 13:08:22 CDT 2004
As I said, I got this from a code site... if you have a simplier
version that would work, I would be interested in seeing it...
On Sat, 25 Sep 2004 18:56:43 +0200, Troy III Ajnej
<trojani2000 at hotmail.com> wrote:
> I'm overwhelmed, this code is a fckn novel, are u sure you will put this
> code in your page?
> Can't this all be done in e few lines of code?!!
>
> >From: GH <GaryHotko at gmail.com>
> >Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
> >To: javascript at LaTech.edu
> >Subject: [Javascript] Trying to get this code to work
> >Date: Sat, 25 Sep 2004 11:58:58 -0400
>
>
> >
> >Greetings. I got this code for a Fade-In slide show from a depository
> >of code I have been trying to modify it so that I can have 2 instances
> >run at the same time on the same page with 2 diffrent sets of images.
> >
> >What i did was append 'nyc_' infront of the variable and user defined
> >functions for the 1st instance.. and 'fed_' for the 2nd instance.
> >
> >The second instance shows up. But the 1st instance does not... only a
> >blank space the equivalent to the the space it should use is there.
> >
> >Please assit. if there is anything that anyone can suggest, I would be
> >greatful. I have the code for instance 1 listed at
> >http://phpaste.com/537 with line numbers.... thank you.
> >
> >
> >
> >## 1st instance ##
> ><script language="JavaScript1.2">
> >/* To save space removed the credits */
> > var nyc_slideshow_width='180px' //SET IMAGE WIDTH
> > var nyc_slideshow_height='90px' //SET IMAGE HEIGHT
> > var nyc_pause=0300 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
> >
> > var nyc_fadeimages=new Array()
> > //SET IMAGE PATHS. Extend or contract array as needed
> > nyc_fadeimages[0]="images/threat_advisory/gmh/high-NYC_2v1.png"
> > nyc_fadeimages[1]="images/threat_advisory/gmh/high-NYC_1v1.png"
> > ////NO need to edit beyond here/////////////
> >
> > var nyc_preloadedimages=new Array()
> > for (p=0;p<nyc_fadeimages.length;p++){
> > nyc_preloadedimages[p]=new Image()
> > nyc_preloadedimages[p].src=nyc_fadeimages[p]
> > }
> >
> > var nyc_ie4=document.all
> > var nyc_dom=document.getElementById
> >
> > if (nyc_ie4||nyc_dom)
> > document.write('<div
> >style="position:relative;width:'+nyc_slideshow_width+';height:'+nyc_slideshow_height+';overflow:hidden"><div
> > id="nyc_canvas0"
> >style="position:absolute;width:'+nyc_slideshow_width+';height:'+nyc_slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div
> >id="nyc_canvas1"
> >style="position:absolute;width:'+nyc_slideshow_width+';height:'+nyc_slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div></div>')
> > else
> > document.write('<img name="nyc_defaultslide"
> >src="'+nyc_fadeimages[0]+'">')
> >
> > var nyc_curpos=10
> > var nyc_degree=10
> > var nyc_curcanvas="nyc_canvas0"
> > var nyc_curimageindex=0
> > var nyc_nextimageindex=1
> >
> >
> > function nyc_fadepic(){
> > if (nyc_curpos<100){
> > nyc_curpos+=10
> > if (nyc_tempobj.filters)
> > nyc_tempobj.filters.alpha.opacity=nyc_curpos
> > else if (nyc_tempobj.style.MozOpacity)
> > nyc_tempobj.style.MozOpacity=nyc_curpos/100
> > }
> > else{
> > clearInterval(nyc_dropslide)
> > nyc_nextcanvas=(nyc_curcanvas=="nyc_canvas0")? "nyc_canvas0" :
> >"nyc_canvas1"
> > nyc_tempobj=nyc_ie4? eval("document.all."+nyc_nextcanvas) :
> >document.getElementById(nyc_nextcanvas)
> > nyc_tempobj.innerHTML='<img src="'+nyc_fadeimages[nyc_nextimageindex]+'">'
> > nyc_nextimageindex=(nyc_nextimageindex<nyc_fadeimages.length-1)?
> >nyc_nextimageindex+1 : 0
> > setTimeout("nyc_rotateimage()",nyc_pause)
> > }
> > }
> >
> > function nyc_rotateimage(){
> > if (nyc_ie4||nyc_dom){
> > nyc_resetit(nyc_curcanvas)
> > var nyc_crossobj=nyc_tempobj=nyc_ie4?
> >eval("document.all."+nyc_curcanvas) :
> >document.getElementById(nyc_curcanvas)
> > nyc_crossobj.style.zIndex++
> > var nyc_temp='setInterval("nyc_fadepic()",50)'
> > nyc_dropslide=eval(nyc_temp)
> > nyc_curcanvas=(nyc_curcanvas=="nyc_canvas0")? "nyc_canvas1" :
> >"nyc_canvas0"
> > }
> > else
> > document.images.nyc_defaultslide.src=nyc_fadeimages[nyc_curimageindex]
> > nyc_curimageindex=(nyc_curimageindex<nyc_fadeimages.length-1)?
> >nyc_curimageindex+1 : 0
> > }
> >
> > function nyc_resetit(nyc_what){
> > nyc_curpos=10
> > var nyc_crossobj=nyc_ie4? eval("document.all."+nyc_what) :
> >document.getElementById(nyc_what)
> > if (nyc_crossobj.filters)
> > nyc_crossobj.filters.alpha.opacity=nyc_curpos
> > else if (nyc_crossobj.style.MozOpacity)
> > nyc_crossobj.style.MozOpacity=nyc_curpos/100
> > }
> >
> > function nyc_startit(){
> > var nyc_crossobj=nyc_ie4? eval("document.all."+nyc_curcanvas) :
> >document.getElementById(nyc_curcanvas)
> > nyc_crossobj.innerHTML='<img src="'+nyc_fadeimages[nyc_curimageindex]+'">'
> > nyc_rotateimage()
> > }
> >
> > if (nyc_ie4||nyc_dom)
> > window.onload=nyc_startit
> > else
> > setInterval("nyc_rotateimage()",nyc_pause)
> >
> > </script>
> >
> >
> >
> >
> >
> >## SECOND INSTANCE ##
> >
> ><script language="JavaScript1.2">
> >/* To save space removed the credits */
> >var fed_slideshow_width='180px' //SET IMAGE WIDTH
> >var fed_slideshow_height='90px' //SET IMAGE HEIGHT
> >var fed_pause=0300 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
> >
> >var fed_fadeimages=new Array()
> >//SET IMAGE PATHS. Extend or contract array as needed
> >fed_fadeimages[0]="images/threat_advisory/gmh/elevated-DHS_2v1.png"
> > fed_fadeimages[1]="images/threat_advisory/gmh/elevated-DHS_1v1.png" ////NO
> >need to edit beyond here/////////////
> >
> > var fed_preloadedimages=new Array()
> > for (p=0;p<fed_fadeimages.length;p++){
> > fed_preloadedimages[p]=new Image()
> > fed_preloadedimages[p].src=fed_fadeimages[p]
> > }
> >
> > var fed_ie4=document.all
> > var fed_dom=document.getElementById
> >
> > if (fed_ie4||fed_dom)
> > document.write('<div
> >style="position:relative;width:'+fed_slideshow_width+';height:'+fed_slideshow_height+';overflow:hidden"><div
> > id="fed_canvas0"
> >style="position:absolute;width:'+fed_slideshow_width+';height:'+fed_slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div
> >id="fed_canvas1"
> >style="position:absolute;width:'+fed_slideshow_width+';height:'+fed_slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div></div>')
> > else
> > document.write('<img name="fed_defaultslide"
> >src="'+fed_fadeimages[0]+'">')
> >
> > var fed_curpos=10
> > var fed_degree=10
> > var fed_curcanvas="fed_canvas0"
> > var fed_curimageindex=0
> > var fed_nextimageindex=1
> >
> >
> > function fed_fadepic(){
> > if (fed_curpos<100){
> > fed_curpos+=10
> > if (fed_tempobj.filters)
> > fed_tempobj.filters.alpha.opacity=fed_curpos
> > else if (fed_tempobj.style.MozOpacity)
> > fed_tempobj.style.MozOpacity=fed_curpos/100
> > }
> > else{
> > clearInterval(fed_dropslide)
> > fed_nextcanvas=(fed_curcanvas=="fed_canvas0")? "fed_canvas0" :
> >"fed_canvas1"
> > fed_tempobj=fed_ie4? eval("document.all."+fed_nextcanvas) :
> >document.getElementById(fed_nextcanvas)
> > fed_tempobj.innerHTML='<img src="'+fed_fadeimages[fed_nextimageindex]+'">'
> > fed_nextimageindex=(fed_nextimageindex<fed_fadeimages.length-1)?
> >fed_nextimageindex+1 : 0
> > setTimeout("fed_rotateimage()",fed_pause)
> > }
> > }
> >
> > function fed_rotateimage(){
> > if (fed_ie4||fed_dom){
> > fed_resetit(fed_curcanvas)
> > var fed_crossobj=fed_tempobj=fed_ie4?
> >eval("document.all."+fed_curcanvas) :
> >document.getElementById(fed_curcanvas)
> > fed_crossobj.style.zIndex++
> > var fed_temp='setInterval("fed_fadepic()",50)'
> > fed_dropslide=eval(fed_temp)
> > fed_curcanvas=(fed_curcanvas=="fed_canvas0")? "fed_canvas1" :
> >"fed_canvas0"
> > }
> > else
> > document.images.fed_defaultslide.src=fed_fadeimages[fed_curimageindex]
> > fed_curimageindex=(fed_curimageindex<fed_fadeimages.length-1)?
> >fed_curimageindex+1 : 0
> > }
> >
> > function fed_resetit(fed_what){
> > fed_curpos=10
> > var fed_crossobj=fed_ie4? eval("document.all."+fed_what) :
> >document.getElementById(fed_what)
> > if (fed_crossobj.filters)
> > fed_crossobj.filters.alpha.opacity=fed_curpos
> > else if (fed_crossobj.style.MozOpacity)
> > fed_crossobj.style.MozOpacity=fed_curpos/100
> > }
> >
> > function fed_startit(){
> > var fed_crossobj=fed_ie4? eval("document.all."+fed_curcanvas) :
> >document.getElementById(fed_curcanvas)
> > fed_crossobj.innerHTML='<img src="'+fed_fadeimages[fed_curimageindex]+'">'
> > fed_rotateimage()
> > }
> >
> > if (fed_ie4||fed_dom)
> > window.onload=fed_startit
> > else
> > setInterval("fed_rotateimage()",fed_pause)
> >
> ></script>
> >_______________________________________________
> >Javascript mailing list
> >Javascript at LaTech.edu
> >https://lists.LaTech.edu/mailman/listinfo/javascript
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
More information about the Javascript
mailing list