PDA

View Full Version : I need to centre a banner rotator code please


gemmk1
04-26-2011, 09:49 PM
I need to centre the banner code ive tried adding the <centre></centre> but cant do it.It is a banner roatator code it sits to the left of my forum.I tried the banner rotator mods but could not get them working.This works it just does not sit to the centre

Here is the code thank you

<script>
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
function create() {
this.width = ''
this.height = ''
this.src = ''
this.href = ''
this.border = ''
this.mouseover = ''
this.sponsor = ''
}
ads = new Array()
for(var i=1; i<=5; i++) { ads[i] = new create() }

ads[1].width = "468"
ads[1].height = "60"
ads[1].src = "http://209.85.12.237/30111/6/0/f5128781/GDAdsBanner.gif"
ads[1].href = "http://gdforum.net"
ads[1].border = "0"
ads[1].mouseover = "Click here to enter the gd forum"
ads[1].sponsor = "best general chat forum around"

ads[2].width = "468"
ads[2].height = "60"
ads[2].src = "http://209.85.12.237/30111/6/0/f5144304/s2f3.png"
ads[2].href = "http://s2fpromotion.co.uk"
ads[2].border = "0"
ads[2].mouseover = "s2f promotion"
ads[2].sponsor = "best free promotion website around"

ads[3].width = "287"
ads[3].height = "60"
ads[3].src = "http://simplythebest.net/images/stbnetmain.gif"
ads[3].href = "http://simplythebest.net"
ads[3].border = "0"
ads[3].mouseover = "Do we need to say more?"
ads[3].sponsor = "Simply the Best"

ads[4].width = "468"
ads[4].height = "60"
ads[4].src = "http://i42.photobucket.com/albums/e303/jlmf/logo-2.gif"
ads[4].href = "http://strangers2friends.co.uk"
ads[4].border = "0"
ads[4].mouseover = "friendship and support forum"
ads[4].sponsor = "strangers 2 friends"



var n = Math.random() + ''
n = parseInt(n.charAt(5))
if(n >5) {
n = n - 5
}
else if(n==0) {
n = n + 5
}
n += ""

var image = ads[n]
var ad = ""
ad += '<a href="' + image.href + '" \n'
ad += 'onMouseOver="self.status=\'' + image.mouseover + '\'\;return true" \n'
ad += 'onMouseOut="self.status=\'\'"> \n'
ad += '<img src="' + image.src + '" width=' + image.width
ad += '\n height=' + image.height + ' border=' + image.border
ad += '\n><br>Please visit our sponsor: ' + image.sponsor + '</a>'
</script>




<script language="JavaScript">
<!-- hiding this script
document.write(ad)
// -->
</script>


Thank you in advance

bananalive
04-26-2011, 10:04 PM
I need to centre the banner code ive tried adding the <centre></centre> but cant do it.It is a banner roatator code it sits to the left of my forum.I tried the banner rotator mods but could not get them working.This works it just does not sit to the centre

Here is the code thank you
...


Thank you in advance
I've highlighted in red lines to change:

<script>
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
function create() {
this.width = ''
this.height = ''
this.src = ''
this.href = ''
this.border = ''
this.mouseover = ''
this.sponsor = ''
}
ads = new Array()
for(var i=1; i<=5; i++) { ads[i] = new create() }

ads[1].width = "468"
ads[1].height = "60"
ads[1].src = "http://209.85.12.237/30111/6/0/f5128781/GDAdsBanner.gif"
ads[1].href = "http://gdforum.net"
ads[1].border = "0"
ads[1].mouseover = "Click here to enter the gd forum"
ads[1].sponsor = "best general chat forum around"

ads[2].width = "468"
ads[2].height = "60"
ads[2].src = "http://209.85.12.237/30111/6/0/f5144304/s2f3.png"
ads[2].href = "http://s2fpromotion.co.uk"
ads[2].border = "0"
ads[2].mouseover = "s2f promotion"
ads[2].sponsor = "best free promotion website around"

ads[3].width = "287"
ads[3].height = "60"
ads[3].src = "http://simplythebest.net/images/stbnetmain.gif"
ads[3].href = "http://simplythebest.net"
ads[3].border = "0"
ads[3].mouseover = "Do we need to say more?"
ads[3].sponsor = "Simply the Best"

ads[4].width = "468"
ads[4].height = "60"
ads[4].src = "http://i42.photobucket.com/albums/e303/jlmf/logo-2.gif"
ads[4].href = "http://strangers2friends.co.uk"
ads[4].border = "0"
ads[4].mouseover = "friendship and support forum"
ads[4].sponsor = "strangers 2 friends"



var n = Math.random() + ''
n = parseInt(n.charAt(5))
if(n >5) {
n = n - 5
}
else if(n==0) {
n = n + 5
}
n += ""

var image = ads[n]
var ad = "<div style=\"text-align:center;\">"
ad += '<a href="' + image.href + '" \n'
ad += 'onMouseOver="self.status=\'' + image.mouseover + '\'\;return true" \n'
ad += 'onMouseOut="self.status=\'\'"> \n'
ad += '<img src="' + image.src + '" width=' + image.width
ad += '\n height=' + image.height + ' border=' + image.border
ad += '\n><br>Please visit our sponsor: ' + image.sponsor + '</a></div>'
</script>




<script language="JavaScript">
<!-- hiding this script
document.write(ad)
// -->
</script>

gemmk1
04-26-2011, 10:15 PM
Thank you so much that worked a charm for me

sorry the only think now is no one can click them they show but it does nothing if you click it

bananalive
04-27-2011, 08:44 PM
Thank you so much that worked a charm for me

sorry the only think now is no one can click them they show but it does nothing if you click it

Try changing this line:

var ad = "<div style=\"text-align:center;\""

to

var ad = "<div style=\"text-align:center;\">"