TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,946
  • Latest: Sparo
Stats
  • Total Posts: 195,718
  • Total Topics: 21,276
  • Online today: 70
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 59
  • Total: 59

sliding banners

Started by phpshiva, November 12, 2008, 03:55:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

phpshiva

You can put this in a scriptbox
To use for banners or affiliate ads

Demo

<script language="JavaScript1.2">

//you can alter the width here  (in pixels)
var sliderwidth=600
//you can alter the heigt here (in pixels )
var sliderheight=100
//you can alter the seed here (higher is faster)
var slidespeed=4


var leftrightslide=new Array()
var finalslide=''
// alter below your url's (a href ) and the pictures (img scr )
leftrightslide[0]='<a href="http://www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60"  border=0></a>'
leftrightslide[1]='<a href="www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60" border=0></a>'
leftrightslide[2]='<a href="www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60" border=0></a>'
leftrightslide[3]='<a href="www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60" border=0></a>'
///////Dont alter below////////////////////////////////////

var copyspeed=slidespeed

for (i=0;i<leftrightslide.length;i++)
finalslide=finalslide+leftrightslide[i]+"  "


if (document.all){
document.write('<marquee id="ieslider" scrollAmount=0 style="width:'+sliderwidth+'">'+finalslide+'</marquee>')
ieslider.onmouseover=new Function("ieslider.scrollAmount=0")
ieslider.onmouseout=new Function("if (document.readyState=='complete') ieslider.scrollAmount=slidespeed")
}

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
document.ns_slider01.visibility="show"
setTimeout("window.onresize=regenerate",450)
intializeleftrightslide()
}
if (document.all)
ieslider.scrollAmount=slidespeed
}

function intializeleftrightslide(){
document.ns_slider01.document.ns_slider02.document.write('<nobr>'+finalslide+'</nobr>')
document. ns_slider01.document.ns_slider02.document.close()
thelength=document.ns_slider01.document.ns_slider02.document.width
scrollslide()
}

function scrollslide(){
if (document.ns_slider01.document.ns_slider02.left>=thelength*(-1)){
document.ns_slider01.document.ns_slider02.left-=slidespeed
setTimeout("scrollslide()",100)
}
else{
document.ns_slider01.document.ns_slider02.left=sliderwidth
scrollslide()
}
}
window.onload=regenerate2

//-->
</script>


<ilayer width=&{sliderwidth}; height=&{sliderheight}; name="ns_slider01" visibility=hide>
<layer name="ns_slider02" onMouseover="slidespeed=0;" onMouseout="slidespeed=copyspeed"></layer>
</ilayer>



this will slide your banners from right to left .
and its easy to put more banner in it

G6Cad

Please repost your code, and this time, in code tags as the code render wrongly with out it.
Also, i will move this to the proper board.

phpshiva

Sorry for that G6

Did the tags now


G6Cad


Bluto

Looks great ! I can't understand the top that is commented out. Doest that part matter?
Or could someone translate?

phpshiva

there is nothing comment out
i translated the code for you

have fun

SmokyBlue



you did a great job, thanks for sharing, phpshiva :D

Bluto

Thank you. Looks very useful.

phpshiva

Your welcom


you can add more banners like this
leftrightslide[4]='<a href="www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60" border=0></a>'
leftrightslide[5]='<a href="www.yoursite.com"><img src="http://www.yoursite.com/bannerhere" width="468" height="60" border=0></a>'



Greetz phpshiva

Bluto

#9
Thanks. I think I will use this for featured affiliates. The ones that deserve the big banners.
Edit: I think I might add an "alt" tag in there to make the spiders happy as well as people with slow connections.

This website is proudly hosted on Crocweb Cloud Website Hosting.