Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Vertical Scroll Banner


Message #1 by Martin McIntyre <MartinM@s...> on Fri, 19 Jan 2001 12:35:33 -0000
Can anyone point me to a vertical scrolling banner component ?



I know I can use scroll on a page or DIV, I but is there a component that

can do it.



I just need to have a little box that scrolls up every so often with new

details as it arrives. (continually scrolling around)



Thanks in advance

Martin





Message #2 by "David Hemingway" <david_hemingway@l...> on Sat, 20 Jan 2001 12:36:41 -0000
This is not exactly what your looking for but with a little modification it

will do what you want.



!!CODE



<%

'  Dim objProfiler

'  Set objProfiler = Server.CreateObject("Softwing.Profiler")



  'Begin timing the execution

'  objProfiler.ProfileStart()

 %>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%

' Call to adserver

set objAd = Application("Ad")

HistoryString = Session("HistoryString")

TagList = array("Ad.Size.Banner","Ad.Border.0","update")



Dim one

Dim two

Dim three

Dim Four



one = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

two = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

three = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

four = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

one = mid(one,42)

two = mid(two,42)

three = mid(three,42)

four = mid(four,42)

%>

<html>

<head>

	<title>Untitled</title>

</head>



<body>



<script language="JavaScript1.2">



var scrollerwidth='468'

var scrollerheight='60'

var scrollerbgcolor='white'

//3000 miliseconds=3 seconds

var pausebetweenimages=6000





var slideimages=new Array()

slideimages[0]='<%= one %>'

slideimages[1]='<%= two %>'

slideimages[2]='<%= three %>'

slideimages[3]='<%= four %>'





if (slideimages.length>1)

i=2

else

i=0



function move1(whichlayer){

tlayer=eval(whichlayer)

if (tlayer.top>0&&tlayer.top<=5){

tlayer.top=0

setTimeout("move1(tlayer)",pausebetweenimages)

setTimeout("move2(document.main.document.second)",pausebetweenimages)

return

}

if (tlayer.top>=tlayer.document.height*-1){

tlayer.top-=5

setTimeout("move1(tlayer)",100)

}

else{

tlayer.top=scrollerheight

tlayer.document.write(slideimages[i])

tlayer.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)",100)

}

else{

tlayer2.top=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 (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=5){

tdiv.style.pixelTop=0

setTimeout("move3(tdiv)",pausebetweenimages)

setTimeout("move4(second2)",pausebetweenimages)

return

}

if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){

tdiv.style.pixelTop-=5

setTimeout("move3(tdiv)",100)

}

else{

tdiv.style.pixelTop=scrollerheight

tdiv.innerHTML=slideimages[i]

if (i==slideimages.length-1)

i=0

else

i++

}

}



function move4(whichdiv){

tdiv2=eval(whichdiv)

if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=5){

tdiv2.style.pixelTop=0

setTimeout("move4(tdiv2)",pausebetweenimages)

setTimeout("move3(first2)",pausebetweenimages)

return

}

if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){

tdiv2.style.pixelTop-=5

setTimeout("move4(second2)",100)

}

else{

tdiv2.style.pixelTop=scrollerheight

tdiv2.innerHTML=slideimages[i]

if (i==slideimages.length-1)

i=0

else

i++

}

}



function startscroll(){

if (document.all){

move3(first2)

second2.style.top=scrollerheight

}

else if (document.layers){

document.main.visibility='show'

move1(document.main.document.first)

document.main.document.second.top=scrollerheight+5

document.main.document.second.visibility='show'

}

}



window.onload=startscroll



</script>

<ilayer id="main" width=&{scrollerwidth}; height=&{scrollerheight};

bgColor=&{scrollerbgcolor}; 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[1])

</script>

</layer>

</ilayer>



<script language="JavaScript1.2">

if (document.all){

document.writeln('<span id="main2"

style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';o

verflow:hiden;background-color:'+scrollerbgcolor+'">')

document.writeln('<div

style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';c

lip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0;top:0">')

document.writeln('<div id="first2"

style="position:absolute;width:'+scrollerwidth+';left:0;top:1;">')

document.write(slideimages[0])

document.writeln('</div>')

document.writeln('<div id="second2"

style="position:absolute;width:'+scrollerwidth+';left:0;top:0">')

document.write(slideimages[1])

document.writeln('</div>')

document.writeln('</div>')

document.writeln('</span>')

}

</script>





</body>

</html>

<%

'Determine how long the processing took

'  Dim dblTimeElapsed

'  dblTimeElapsed = objProfiler.ProfileStop()

'  Response.Write "<p>Time Elapsed: " & dblTimeElapsed



'  Set objProfiler = Nothing

 %>



!!END OF CODE





It basically loads four banners from microsofts ad server in to a javascript

array and used dhtml to rotate them. If you do rebuild it as a component,

please would you let me have a copy. I have only tested this with ie4+ on a

pc and netscape4.7 on a mac and it works.



Regards

David



It's crazy enought, it just might work





-----Original Message-----

From: Martin McIntyre [mailto:MartinM@s...]

Sent: 19 January 2001 12:36

To: ASP components

Subject: [asp_components] Vertical Scroll Banner





Can anyone point me to a vertical scrolling banner component ?



I know I can use scroll on a page or DIV, I but is there a component that

can do it.



I just need to have a little box that scrolls up every so often with new

details as it arrives. (continually scrolling around)



Thanks in advance

Martin



Message #3 by Martin McIntyre <MartinM@s...> on Mon, 22 Jan 2001 09:11:32 -0000
I'm getting an error Object Undefined line 12.



Since Layers are mentioned I guess this is the Netscape version. Do you have

a similar one for IE ?



Where does the Application("Ad") value come from ?



Cheers

Martin



-----Original Message-----

From: David Hemingway [mailto:david_hemingway@l...]

Sent: 20 January 2001 12:37

To: ASP components

Subject: [asp_components] RE: Vertical Scroll Banner





This is not exactly what your looking for but with a little modification it

will do what you want.



!!CODE



<%

'  Dim objProfiler

'  Set objProfiler = Server.CreateObject("Softwing.Profiler")



  'Begin timing the execution

'  objProfiler.ProfileStart()

 %>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%

' Call to adserver

set objAd = Application("Ad")

HistoryString = Session("HistoryString")

TagList = array("Ad.Size.Banner","Ad.Border.0","update")



Dim one

Dim two

Dim three

Dim Four



one = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

two = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

three = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

four = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

one = mid(one,42)

two = mid(two,42)

three = mid(three,42)

four = mid(four,42)

%>

<html>

<head>

	<title>Untitled</title>

</head>



<body>



<script language="JavaScript1.2">



var scrollerwidth='468'

var scrollerheight='60'

var scrollerbgcolor='white'

//3000 miliseconds=3 seconds

var pausebetweenimages=6000





var slideimages=new Array()

slideimages[0]='<%= one %>'

slideimages[1]='<%= two %>'

slideimages[2]='<%= three %>'

slideimages[3]='<%= four %>'





if (slideimages.length>1)

i=2

else

i=0



function move1(whichlayer){

tlayer=eval(whichlayer)

if (tlayer.top>0&&tlayer.top<=5){

tlayer.top=0

setTimeout("move1(tlayer)",pausebetweenimages)

setTimeout("move2(document.main.document.second)",pausebetweenimages)

return

}

if (tlayer.top>=tlayer.document.height*-1){

tlayer.top-=5

setTimeout("move1(tlayer)",100)

}

else{

tlayer.top=scrollerheight

tlayer.document.write(slideimages[i])

tlayer.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)",100)

}

else{

tlayer2.top=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 (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=5){

tdiv.style.pixelTop=0

setTimeout("move3(tdiv)",pausebetweenimages)

setTimeout("move4(second2)",pausebetweenimages)

return

}

if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){

tdiv.style.pixelTop-=5

setTimeout("move3(tdiv)",100)

}

else{

tdiv.style.pixelTop=scrollerheight

tdiv.innerHTML=slideimages[i]

if (i==slideimages.length-1)

i=0

else

i++

}

}



function move4(whichdiv){

tdiv2=eval(whichdiv)

if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=5){

tdiv2.style.pixelTop=0

setTimeout("move4(tdiv2)",pausebetweenimages)

setTimeout("move3(first2)",pausebetweenimages)

return

}

if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){

tdiv2.style.pixelTop-=5

setTimeout("move4(second2)",100)

}

else{

tdiv2.style.pixelTop=scrollerheight

tdiv2.innerHTML=slideimages[i]

if (i==slideimages.length-1)

i=0

else

i++

}

}



function startscroll(){

if (document.all){

move3(first2)

second2.style.top=scrollerheight

}

else if (document.layers){

document.main.visibility='show'

move1(document.main.document.first)

document.main.document.second.top=scrollerheight+5

document.main.document.second.visibility='show'

}

}



window.onload=startscroll



</script>

<ilayer id="main" width=&{scrollerwidth}; height=&{scrollerheight};

bgColor=&{scrollerbgcolor}; 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[1])

</script>

</layer>

</ilayer>



<script language="JavaScript1.2">

if (document.all){

document.writeln('<span id="main2"

style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';o

verflow:hiden;background-color:'+scrollerbgcolor+'">')

document.writeln('<div

style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';c

lip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0;top:0">')

document.writeln('<div id="first2"

style="position:absolute;width:'+scrollerwidth+';left:0;top:1;">')

document.write(slideimages[0])

document.writeln('</div>')

document.writeln('<div id="second2"

style="position:absolute;width:'+scrollerwidth+';left:0;top:0">')

document.write(slideimages[1])

document.writeln('</div>')

document.writeln('</div>')

document.writeln('</span>')

}

</script>





</body>

</html>

<%

'Determine how long the processing took

'  Dim dblTimeElapsed

'  dblTimeElapsed = objProfiler.ProfileStop()

'  Response.Write "<p>Time Elapsed: " & dblTimeElapsed



'  Set objProfiler = Nothing

 %>



!!END OF CODE





It basically loads four banners from microsofts ad server in to a javascript

array and used dhtml to rotate them. If you do rebuild it as a component,

please would you let me have a copy. I have only tested this with ie4+ on a

pc and netscape4.7 on a mac and it works.



Regards

David



It's crazy enought, it just might work





-----Original Message-----

From: Martin McIntyre [mailto:MartinM@s...]

Sent: 19 January 2001 12:36

To: ASP components

Subject: [asp_components] Vertical Scroll Banner





Can anyone point me to a vertical scrolling banner component ?



I know I can use scroll on a page or DIV, I but is there a component that

can do it.



I just need to have a little box that scrolls up every so often with new

details as it arrives. (continually scrolling around)



Thanks in advance

Martin



Message #4 by "David Hemingway" <david_hemingway@l...> on Mon, 22 Jan 2001 19:42:14 -0000
the code works in ie. the application("ad") is a call to my microsoft

adserver applcation which is set up in the global.asa, you will need to

delete this line along with the objProfiler stuff, which is a timmer object

from softwing that i use to optomize code.



<%

' Call to adserver

set objAd = Application("Ad")

HistoryString = Session("HistoryString")

TagList = array("Ad.Size.Banner","Ad.Border.0","update")



Dim one

Dim two

Dim three

Dim Four



one = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

two = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

three = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

four = replace(objAd.GetAd(Response, TagList,

HistoryString),"INSERT-DATE-TIME-HERE",Now())

one = mid(one,42)

two = mid(two,42)

three = mid(three,42)

four = mid(four,42)

%>



all that the above code does is loads ad's into the variables one, two,

three and four. If you have any problems send me the ad stuf and I'll take

you through it.



Cheers



David





-----Original Message-----

From: Martin McIntyre [mailto:MartinM@s...]

Sent: 22 January 2001 09:12

To: ASP components

Subject: [asp_components] RE: Vertical Scroll Banner





I'm getting an error Object Undefined line 12.



Since Layers are mentioned I guess this is the Netscape version. Do you have

a similar one for IE ?



Where does the Application("Ad") value come from ?



Cheers

Martin


  Return to Index