Please help me with this script.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • |:::. George .::::|

    #1

    Please help me with this script.

    Hi,

    When I put the first javascript, it works fine. As soon as I put the
    second one, the effect stops on both and you can't see any pictures.
    This is the script I'm using. {How can I have this effect in 3 areas of
    the page?}What area of the script need to be change?

    Thank you for your help.


    =============== =============== =============== =============== =============== =============== =========

    <script language="JavaS cript1.2" type="text/javascript">

    var slideshow_width ='140px'
    var slideshow_heigh t='225px'
    var pause=3000

    var fadeimages=new Array()
    fadeimages[0]="photo1.jpg "
    fadeimages[1]="photo2.jpg "
    fadeimages[2]="photo3.jpg "

    ////NO need to edit beyond here/////////////

    var preloadedimages =new Array()
    for (p=0;p<fadeimag es.length;p++){
    preloadedimages[p]=new Image()
    preloadedimages[p].src=fadeimages[p]
    }

    var ie4=document.al l
    var dom=document.ge tElementById

    if (ie4||dom)
    document.write( '<div
    style="position :relative;width :'+slideshow_wi dth+';height:'+ slideshow_heigh t+';overflow:hi dden"><div

    id="canvas0"


    style="position :absolute;width :'+slideshow_wi dth+';height:'+ slideshow_heigh t+';top:0;left: 0;filter:alpha( opacity=10);-moz-opacity:10"></div><div

    id="canvas1"


    style="position :absolute;width :'+slideshow_wi dth+';height:'+ slideshow_heigh t+';top:0;left: 0;filter:alpha( opacity=10);-moz-opacity:10;visi bility:

    hidden"></div></div>')
    else
    document.write( '<img name="defaultsl ide" src="'+fadeimag es[0]+'">')

    var curpos=10
    var degree=10
    var curcanvas="canv as0"
    var curimageindex=0
    var nextimageindex= 1


    function fadepic(){
    if (curpos<100){
    curpos+=10
    if (tempobj.filter s)
    tempobj.filters .alpha.opacity= curpos
    else if (tempobj.style. MozOpacity)
    tempobj.style.M ozOpacity=curpo s/101
    }
    else{
    clearInterval(d ropslide)
    nextcanvas=(cur canvas=="canvas 0")? "canvas0" : "canvas1"
    tempobj=ie4? eval("document. all."+nextcanva s) :
    document.getEle mentById(nextca nvas)
    tempobj.innerHT ML='<img src="'+fadeimag es[nextimageindex]+'">'
    nextimageindex= (nextimageindex <fadeimages.len gth-1)? nextimageindex+ 1 :
    0
    var tempobj2=ie4? eval("document. all."+nextcanva s) :
    document.getEle mentById(nextca nvas)
    tempobj2.style. visibility="hid den"
    setTimeout("rot ateimage()",pau se)
    }
    }

    function rotateimage(){
    if (ie4||dom){
    resetit(curcanv as)
    var crossobj=tempob j=ie4? eval("document. all."+curcanvas ) :
    document.getEle mentById(curcan vas)
    crossobj.style. zIndex++
    tempobj.style.v isibility="visi ble"
    var temp='setInterv al("fadepic()", 50)'
    dropslide=eval( temp)
    curcanvas=(curc anvas=="canvas0 ")? "canvas1" : "canvas0"
    }
    else
    document.images .defaultslide.s rc=fadeimages[curimageindex]
    curimageindex=( curimageindex<f adeimages.lengt h-1)? curimageindex+1 : 0
    }

    function resetit(what){
    curpos=10
    var crossobj=ie4? eval("document. all."+what) :
    document.getEle mentById(what)
    if (crossobj.filte rs)
    crossobj.filter s.alpha.opacity =curpos
    else if (crossobj.style .MozOpacity)
    crossobj.style. MozOpacity=curp os/101
    }

    function startit(){
    var crossobj=ie4? eval("document. all."+curcanvas ) :
    document.getEle mentById(curcan vas)
    crossobj.innerH TML='<img src="'+fadeimag es[curimageindex]+'">'
    rotateimage()
    }

    if (ie4||dom)
    window.onload=s tartit
    else
    setInterval("ro tateimage()",pa use)

    </script>




  • Randy Webb

    #2
    Re: Please help me with this script.

    |:::. George .::::| wrote:[color=blue]
    > Hi,
    >
    > When I put the first javascript, it works fine. As soon as I put the
    > second one, the effect stops on both and you can't see any pictures.[/color]

    Yep. Thats what happens when someone copy/paste a script that they do
    not understand.
    [color=blue]
    > This is the script I'm using.[/color]

    Its junk.
    [color=blue]
    > How can I have this effect in 3 areas of the page?[/color]

    Write a script to do it in 3 places.
    [color=blue]
    > What area of the script need to be change?[/color]

    All of it.
    [color=blue]
    > Thank you for your help.[/color]

    Welcome.

    --
    Randy
    comp.lang.javas cript FAQ - http://jibbering.com/faq

    Comment

    • |:::. George .::::|

      #3
      Re: Please help me with this script.

      Randy, thank you for your answer but could you please pass some of your
      knowledge and help me with this script?

      Thanks

      Randy Webb wrote:
      [color=blue]
      > |:::. George .::::| wrote:[color=green]
      > > Hi,
      > >
      > > When I put the first javascript, it works fine. As soon as I put the
      > > second one, the effect stops on both and you can't see any pictures.[/color]
      >
      > Yep. Thats what happens when someone copy/paste a script that they do
      > not understand.
      >[color=green]
      > > This is the script I'm using.[/color]
      >
      > Its junk.
      >[color=green]
      > > How can I have this effect in 3 areas of the page?[/color]
      >
      > Write a script to do it in 3 places.
      >[color=green]
      > > What area of the script need to be change?[/color]
      >
      > All of it.
      >[color=green]
      > > Thank you for your help.[/color]
      >
      > Welcome.
      >
      > --
      > Randy
      > comp.lang.javas cript FAQ - http://jibbering.com/faq[/color]

      Comment

      • Randy Webb

        #4
        Re: Please help me with this script.

        |:::. George .::::| wrote:[color=blue]
        > Randy, thank you for your answer but could you please pass some of your
        > knowledge and help me with this script?
        >
        > Thanks[/color]

        The group FAQ is linked to in my signature. You should read it,
        thoroughly along with the rest of my signature.

        Then post what it is, in detail, that you want. I have no desire to wade
        through that garbage code to try to decipher what it's supposed to be doing.

        --
        Randy
        comp.lang.javas cript FAQ - http://jibbering.com/faq
        Answer:It destroys the order of the conversation
        Question: Why?
        Answer: Top-Posting.
        Question: Whats the most annoying thing on Usenet?

        Comment

        Working...