123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
Scroll_n_Pause_Images

--------------------------------------------------------------------------------

Description : Arrange a set of images in a directory and try this program. This will draw the images and pause for a sec. Increase the value pausebetweenimages=n, where n is the value in MilliSecs. This is an embedded Java Script Code. Enjoy ...

<script language="JavaScript1.2">

var scrollerwidth='410px'
var scrollerheight='270px'
var pausebetweenimages=1000


var slideimages=new Array()
slideimages[0]='<img src="Img1.jpg" border="0">'
slideimages[1]='<img src="Img2.jpg">'
slideimages[2]='<img src="Img3.jpg">'
slideimages[3]='<img src="Img4.jpg">'
slideimages[4]='<img src="Img5.jpg">'
slideimages[5]='<img src="Img6.jpg">'
slideimages[6]='<img src="Img7.jpg">'
slideimages[7]='<img src="Img8.jpg">'
slideimages[8]='<img src="Img9.jpg">'
slideimages[9]='<img src="Img10.jpg">'
slideimages[10]='<img src="Img11.jpg">'
slideimages[11]='<img src="Img12.jpg">'
slideimages[12]='<img src="Img13.jpg">'
slideimages[13]='<img src="Img14.jpg">'
slideimages[14]='<img src="Img15.jpg">'
slideimages[15]='<img src="Img16.jpg">'
slideimages[16]='<img src="Img17.jpg">'
slideimages[17]='<img src="Img18.jpg">'
slideimages[18]='<img src="Img19.jpg">'
slideimages[19]='<img src="Img20.jpg">'
slideimages[20]='<img src="Img21.jpg">'
slideimages[21]='<img src="Img22.jpg">'
slideimages[22]='<img src="Img1.jpg">'



var ie=document.all
var dom=document.getElementById

if (slideimages.length>2)
i=2
else
i=0

function move1(whichlayer){
MyLayer=eval(whichlayer)
if (MyLayer.top>0&&MyLayer.top<=5){
MyLayer.top=0
setTimeout("move1(MyLayer)",pausebetweenimages)
setTimeout("move2(document.main.document.second)",pausebetweenimages)
return
}
if (MyLayer.top>=MyLayer.document.height*-1){
MyLayer.top-=5
setTimeout("move1(MyLayer)",50)
}
else{
MyLayer.top=parseInt(scrollerheight)
MyLayer.document.write(slideimages[i])
MyLayer.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}

function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
setTimeout("move2(tlayer2)",pausebetweenimages)
setTimeout("move1(document.main.document.first)",pausebetweenimages)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",50)
}
else{
tlayer2.top=parseInt(scrollerheight)
tlayer2.document.write(slideimages[i])
tlayer2.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}

function move3(whichdiv){
tdiv=eval(whichdiv)
if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
tdiv.style.top=0+"px"
setTimeout("move3(tdiv)",pausebetweenimages)
setTimeout("move4(second2_obj)",pausebetweenimages)
return
}
if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
setTimeout("move3(tdiv)",50)
}
else{
tdiv.style.top=scrollerheight
tdiv.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}

function move4(whichdiv){
tdiv2=eval(whichdiv)
if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
tdiv2.style.top=0+"px"
setTimeout("move4(tdiv2)",pausebetweenimages)
setTimeout("move3(first2_obj)",pausebetweenimages)
return
}
if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
setTimeout("move4(second2_obj)",50)
}
else{
tdiv2.style.top=scrollerheight
tdiv2.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}

function startscroll(){
if (ie||dom){
first2_obj=ie? first2 : document.getElementById("first2")
second2_obj=ie? second2 : document.getElementById("second2")
move3(first2_obj)
second2_obj.style.top=scrollerheight
second2_obj.style.visibility='visible'
}
else if (document.layers){
document.main.visibility='show'
move1(document.main.document.first)
document.main.document.second.top=parseInt(scrollerheight)+5
document.main.document.second.visibility='show'
}
}

window.onload=startscroll

</script>


<ilayer id="main" width=&{scrollerwidth}; height=&{scrollerheight}; visibility=hide>
<layer id="first" left=0 top=1 width=&{scrollerwidth};>
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[0])
</script>
</layer>
<layer id="second" left=0 top=0 width=&{scrollerwidth}; visibility=hide>
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[dyndetermine=(slideimages.length==1)? 0 : 1])
</script>
</layer>
</ilayer>

<script language="JavaScript1.2">
if (ie||dom){
document.writeln('<div id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">')
document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:1px;">')
document.write(slideimages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px;visibility:hidden">')
document.write(slideimages[dyndetermine=(slideimages.length==1)? 0 : 1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</div>')
}
</script>
<body bgcolor=Black>

</body></html>
 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG