How do I centre javascript in a HTML page? Please help!

Ok, I recently set up a website with advertising space. The space is split into banner engines of 10 banners each rotating every 7 seconds.
I have fully tested the coding which I downloaded and it all seems to work as well as I need it to.
The only problem that I have is that the javascript or at least the banner it produces are always firmly stuck to the left. They need to mbe in the centre to fit the rest of the page, but I can't seem to get them to centre.
Here's how the page is set up and coded:
in the page I have:<html>
<head>
<center>
<p>Each test banner links back to this page. Your banner would link to whatever site/location you required.</p>
<p>
<script type=text/javascript src="http://www.UkVariety.co.uk/banner/div_construct2.js"></script>
<script type=text/javascript>
var _banners = new Array();
function addBanner(_bannerHTML){
  _banners[_banners.length?_banners.length:0]=_bannerHTML;
addBanner("<a href='http://www.ukvariety.co.uk/banners.html'><img border=0 alt='Advertiser 1' src='http://www.ukvariety.co.uk/Images/banners/Ad1.gif'></a>");
addBanner("<a href='http://www.ukvariety.co.uk/banners.html'><img border=0 alt='Advertiser 2' src='http://www.ukvariety.co.uk/Images/banners/Ad2.gif'></a>");
addBanner("<a href='http://www.ukvariety.co.uk/banners.html'><img border=0 alt='Advertiser 3' src='http://www.ukvariety.co.uk/Images/banners/Ad3.gif'></a>");
addBanner("<a href='http://www.ukvariety.co.uk/banners.html'><img border=0 alt='Advertiser 4' src='http://www.ukvariety.co.uk/Images/banners/Ad4.gif'></a>");
addBanner("<a href='http://www.ukvariety.co.uk/banners.html'><img border=0 alt='Advertiser 5' src='http://www.ukvariety.co.uk/Images/banners/Ad5.gif'></a>");
addBanner("<a href='http://www.ukvariety.co.uk/banners.html'><img border=0 alt='Advertiser 6' src='http://www.ukvariety.co.uk/Images/banners/Ad6.gif'></a>");
addBanner("<a href='http://www.ukvariety.co.uk/banners.html'><img border=0 alt='Advertiser 7' src='http://www.ukvariety.co.uk/Images/banners/Ad7.gif'></a>");
addBanner("<a href='http://www.ukvariety.co.uk/banners.html'><img border=0 alt='Advertiser 8' src='http://www.ukvariety.co.uk/Images/banners/Ad8.gif'></a>");
addBanner("<a href='http://www.ukvariety.co.uk/banners.html'><img border=0 alt='Advertiser 9' src='http://www.ukvariety.co.uk/Images/banners/Ad9.gif'></a>");
addBanner("<a href='http://www.ukvariety.co.uk/banners.html'><img border=0 alt='Advertiser 10' src='http://www.ukvariety.co.uk/Images/banners/Ad10.gif'></a>");
var div2 = new NewDiv2(window, "banner", _banners[0],0,0,50,50,500,"ABSOLUTE");
var count=0; /* which one to start with */
function doIt() {
count++;
count%=_banners.length;
div2.setBody(_banners[count]);
setInterval('doIt()',7000);
</script>
</p>
</head>
<body>
<script type=text/javascript>
div2.output();
</script>
</body></center>
</html>The javascript links to a file caled div_construct2.js
This file contains the following coding:
isNS = document.layers?true:false;
isIE = navigator.appName.indexOf("Microsoft") != -1
isNS6=document.getElementById&&!isIE?true:false;
function NewDiv2(window, id, body, left, top, width, height, zIndex, absolute) {
    this.window = window;
    this.id     = id;
    this.body   = body;
    var d = window.document;
    d.writeln('<STYLE TYPE="text/css">#' + id + ' {');
     if (absolute) d.write('position:absolute;');
     else          d.write('position:relative;');
    if (left)   d.write('left:'  + left  + ';');
    if (top)    d.write('top:'   + top   + ';');
    if (width)  d.write('width:' + width + ';');
     if (height) d.write('height:' + height + ';');
     if (zIndex) d.write('z-index:' + zIndex + ';');
    d.writeln('}</STYLE>');
if (isNS) {
    NewDiv2.prototype.output             = function()      { var d = this.window.document;d.writeln('<DIV ID="' + this.id + '">');d.writeln(this.body);d.writeln("</DIV>");this.layer = d[this.id];}
    NewDiv2.prototype.moveTo             = function(x,y)   { this.layer.moveTo(x,y); }
    NewDiv2.prototype.moveBy             = function(x,y)   { this.layer.moveBy(x,y); }
    NewDiv2.prototype.show               = function()      { this.layer.visibility = "show"; }
    NewDiv2.prototype.hide               = function()      { this.layer.visibility = "hide"; }
    NewDiv2.prototype.setZ               = function(z)     { this.layer.zIndex = z; }
    NewDiv2.prototype.setBgColor         = function(color) { this.layer.bgColor = color; }
    NewDiv2.prototype.setBgImage         = function(image) { this.layer.background.src = image;}
    NewDiv2.prototype.getX               = function() { return this.layer.left; }
    NewDiv2.prototype.getY               = function() { return this.layer.top; } //was right .. ??
    NewDiv2.prototype.getWidth           = function() { return this.layer.width; }
    NewDiv2.prototype.getHeight          = function() { return this.layer.height; }
    NewDiv2.prototype.getZ               = function() { return this.layer.zIndex; }
    NewDiv2.prototype.isVisible          = function() { return this.layer.visibility == "show"; }
    NewDiv2.prototype.setBody            = function() { for(var i = 0; i < arguments.length; i++) this.layer.document.writeln(arguments);this.layer.document.close();}
NewDiv2.prototype.addEventHandler = function(eventname, handler) {this.layer.captureEvents(NewDiv2._eventmasks[eventname]); var newdivel = this;this.layer[eventname] = function(event) { return handler(newdivel, event.type, event.x, event.y, event.which, event.which,((event.modifiers & Event.SHIFT_MASK) != 0),((event.modifiers & Event.CTRL_MASK)  != 0),((event.modifiers & Event.ALT_MASK)   != 0));}}
NewDiv2.prototype.removeEventHandler = function(eventname) {this.layer.releaseEvents(NewDiv2._eventmasks[eventname]);delete this.layer[eventname];}
NewDiv2.prototype.centerX = function() {this.layer.moveTo(Math.round((window.pageXOffset+document.width-100)/2),this.layer.top)}
NewDiv2._eventmasks = {onabort:Event.ABORT,onblur:Event.BLUR,onchange:Event.CHANGE,onclick:Event.CLICK,ondblclick:Event.DBLCLICK, ondragdrop:Event.DRAGDROP,onerror:Event.ERROR, onfocus:Event.FOCUS,onkeydown:Event.KEYDOWN,onkeypress:Event.KEYPRESS,onkeyup:Event.KEYUP,onload:Event.LOAD,onmousedown:Event.MOUSEDOWN,onmousemove:Event.MOUSEMOVE, onmouseout:Event.MOUSEOUT,onmouseover:Event.MOUSEOVER, onmouseup:Event.MOUSEUP,onmove:Event.MOVE,onreset:Event.RESET,onresize:Event.RESIZE,onselect:Event.SELECT,onsubmit:Event.SUBMIT,onunload:Event.UNLOAD};
if (isIE) {
NewDiv2.prototype.output = function() { var d = this.window.document;d.writeln('<DIV ID="' + this.id + '">');d.writeln(this.body);d.writeln("</DIV>");this.element = d.all[this.id];this.style = this.element.style;}
NewDiv2.prototype.moveTo = function(x,y) { this.style.pixelLeft = x;this.style.pixelTop = y;}
NewDiv2.prototype.moveBy = function(x,y) { this.style.pixelLeft += x;this.style.pixelTop += y;}
NewDiv2.prototype.show = function() { this.style.visibility = "visible"; }
NewDiv2.prototype.hide = function() { this.style.visibility = "hidden"; }
NewDiv2.prototype.setZ = function(z) { this.style.zIndex = z; }
NewDiv2.prototype.setBgColor = function(color) { this.style.backgroundColor = color; }
NewDiv2.prototype.setBgImage = function(image) { this.style.backgroundImage = image;}
NewDiv2.prototype.getX = function() { return this.style.pixelLeft; }
NewDiv2.prototype.getY = function() { return this.style.pixelRight; }
NewDiv2.prototype.getWidth = function() { return this.style.width; }
NewDiv2.prototype.getHeight = function() { return this.style.height; }
NewDiv2.prototype.getZ = function() { return this.style.zIndex; }
NewDiv2.prototype.isVisible = function() { return this.style.visibility == "visible"; }
NewDiv2.prototype.setBody = function() { var body = "";for(var i = 0; i < arguments.length; i++) {body += arguments[i] + "\n";}this.element.innerHTML = body;}
NewDiv2.prototype.addEventHandler = function(eventname, handler) { var NewDiv = this;this.element[eventname] = function() { var e = NewDiv2.window.event;e.cancelBubble = true;return handler(NewDiv2, e.type, e.x, e.y, e.button, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey); }}
NewDiv2.prototype.removeEventHandler = function(eventname) { delete this.element[eventname];}
     NewDiv2.prototype.centerX = function() { this.style.pixelLeft=Math.round((document.body.clientWidth+document.body.scrollLeft-300)/2)}
* The following was written by:
* Dario Guzik
* Spam unfriendly email address: dguzik AT bigfoot DOT com
if (isNS6) {
NewDiv2.prototype.output = function() { var d = this.window.document;d.writeln('<DIV ID="' + this.id + '">');d.writeln(this.body);d.writeln("</DIV>");this.element = d.getElementById(this.id);this.style = this.element.style;}
NewDiv2.prototype.moveTo = function(x,y) { this.style.pixelLeft = x;this.style.pixelTop = y;}
NewDiv2.prototype.moveBy = function(x,y) { this.style.pixelLeft += x;this.style.pixelTop += y;}
NewDiv2.prototype.show = function() { this.style.visibility = "visible"; }
NewDiv2.prototype.hide = function() { this.style.visibility = "hidden"; }
NewDiv2.prototype.setZ = function(z) { this.style.zIndex = z; }
NewDiv2.prototype.setBgColor = function(color) { this.style.backgroundColor = color; }
NewDiv2.prototype.setBgImage = function(image) { this.style.backgroundImage = image;}
NewDiv2.prototype.getX = function() { return this.style.pixelLeft; }
NewDiv2.prototype.getY = function() { return this.style.pixelRight; }
NewDiv2.prototype.getWidth = function() { return this.style.width; }
NewDiv2.prototype.getHeight = function() { return this.style.height; }
NewDiv2.prototype.getZ = function() { return this.style.zIndex; }
NewDiv2.prototype.isVisible = function() { return this.style.visibility == "visible"; }
NewDiv2.prototype.setBody = function() { var body = "";for(var i = 0; i < arguments.length; i++) {body += arguments[i] + "\n";}this.element.innerHTML = body;}
NewDiv2.prototype.addEventHandler = function(eventname, handler) { var NewDiv = this;this.element[eventname] = function() { var e = NewDiv2.window.event;e.cancelBubble = true;return handler(NewDiv, e.type, e.x, e.y, e.button, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey); }}
NewDiv2.prototype.removeEventHandler = function(eventname) { delete this.element[eventname];}
NewDiv2.prototype.centerX = function() { this.style.pixelLeft=Math.round((document.body.clientWidth+document.body.scrollLeft-300)/2)}
If anyone could help, I would be most grateful and could even offer a free advert for a while if needs be.
Thanks in advance
Dave
"I think my brain exploded"

You might want to ask this on a JavaScript forum.
Java and JavaScript are not related.Now his brain probably experienced not just a mere explosion, but more like an atomic one.

Similar Messages

  • Javafx deployment in html page(please help me urgent)

    i used the following method to deploy javafx in an html page.
    javafx file is:
    package hello;
    import javafx.scene.*;
    import javafx.stage.Stage;
    import javafx.scene.text.Text;
    import javafx.scene.text.Font;
    import javafx.scene.paint.Color;
    import javafx.scene.effect.DropShadow;
    Stage {
        title: "My Applet"
        width: 250
        height: 80
        scene: Scene {
            content: Text {
                x: 10  y: 30
                font: Font {
                     size: 24 }
                fill: Color.BLUE
                effect: DropShadow{ offsetX: 3 offsetY: 3}
                content: "VAARTA"
    I save the file as HelloApplet in a 'hello' named folder in my D:
    after that i downloaded from internet html code as
    <html>
        <head>
            <title>Wiki</title>
        </head>
        <body>
            <h1>Wiki</h1>
            <script src="dtfx.js"></script>
            <script>
                javafx(
                    archive: "HelloApplet.jar",
                    draggable: true,
                    width: 150,
                    height: 100,
                    code: "hello.HelloApplet",
                    name: "Wiki"
            </script>
        </body>
    </html>now i typed in DOS prompt as javafxc.exe HelloApplet.fx & i got the class files .
    _The main problem which is coming is how to create HelloApplet.jar file which is used in the html page without which the html page is not displaying the javafx script. Please help me urgently i am in the middle of my project & stuck up due to JAVAFX                   i am using WIndowsXP & javafx-sdk1.0 when i am typing jar command inside hello package it is displaying invalid command.in DOS prompt. If there is any other method to deploy javafx in html page then specify it also.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Crossposted: [http://forums.sun.com/thread.jspa?threadID=5323288].
    Please don't crosspost without notifying others. It is rude in terms of netiquette. Stick to one topic.

  • How to use the LAN NetStream for peer transmission, please help, write a sample code

    How to use the LAN NetStream for peer transmission, please help, write a sample code

    No reply, I reply, Oh

  • I am on Vacations in Nicaragua and I just lost my Ipod. I did not turned on the ICloud. How can I use "Find my Ipod".? please help me?

    I am on Vacations in Nicaragua and I just lost my Ipod. I did not turned on the ICloud. How can I use "Find my Ipod".? please help me.

    You cannot use it.  You would have had to set it up on your ipod itself before you lost it.  Since you did not "turn on the icloud", then you have not set up find my ipod.
    Sorry.
    There is no way to track your ipod.

  • I right clicked my iPod on iTunes and clicked restore from back up because i thought it would undo my IOS6 update. IT DELETED ALL MY PICTURES (2,000) AND I DON'T KNOW HOW TO GET THEM BACK!!!! Please help me!!!!!

    I right clicked my iPod on iTunes and clicked restore from back up because i thought it would undo my IOS6 update. IT DELETED ALL MY PICTURES (2,000) AND I DON'T KNOW HOW TO GET THEM BACK!!!! Please help me!!!!!

    Well, if you have not backed them up, they are gone.
    Next time, when you have important material in only one place, back it up.

  • HT5622 When I was update free OS update I was charged 60 INR four times, I don't how to claim my money back. Could you please help to get my money back?

    When I was update free OS update I was charged 60 INR four times, I don't how to claim my money back. Could you please help to get my money back?

    Did you add or change your credit card details on your iTunes account when downloading them ? If you have then each time that you do so a small temporary store holding charge may be applied to check that the card details are correct and valid and that it's registered to exactly the same name and address as on your iTunes account - it should disappear off your account within a few days or so.
    Store holding charge : http://support.apple.com/kb/HT3702

  • Unable to update software or upload pics from SD card-how do I remove files from startup disk? Please help!

    Unable to update software or upload pics from SD card-how do I remove files from startup disk? Please help!

    Hello Smile_333
    The article below will assist with finding things and help increase the hard drive space for your computer. The best way is to have an external hard drive to copy things to if you do not want to delete and loose things.
    OS X Mountain Lion: Increase disk space
    http://support.apple.com/kb/PH10677
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • I buy my iphone 5 in uae but i live in other country i want use a facetime how can add this feature to my iphone 5 please help me

    i buy my iphone 5 in uae but i live in other country i want use a facetime how can add this feature to my iphone 5 please help me

    If you wanted FaceTime, you should not have purchased your phone in the UAE. There is no way to add it back to your phone, as it has been permanently removed.

  • I reset my phone and it now receives calls that were meant for my husband. I know how to fix this with messaging and facetime, but can't seem to find how to make it stop with the calls. Please help.

    I reset my phone and it now receives calls that were meant for my husband. I know how to fix this with messaging and facetime, but can't seem to find how to make it stop with the calls. Please help.

    It may be due to Continuity
    The following quote is from  Connect your iPhone, iPad, and iPod touch using Continuity
    Turn off iPhone cellular calls
    To turn off iPhone Cellular Calls on a device, go to Settings > FaceTime and turn off iPhone Cellular Calls.

  • HT204023 I have iphone 4(ios 5.1.1)but there are no any icon like personal hotspot. How can i get it to my phone. Please help me. Thank you.

    I have iphone 4(ios 5.1.1)but there are no any icon like personal hotspot. How can i get it to my phone. Please help me. Thank you.

    The personal hotspot is not an app or an icon; it is a setting. You must first have your carrier provision it, then you turn it on in settings. Most carriers charge extra for tethering.

  • I don't know how to download adobe acrobat reader. could some one please help. i don't know much comp terms

    i don't know how to download adobe acrobat reader. could some one please help. i don't know much comp terms
    Mark this discussion as a question-this encourages people to answer for points and helps you track answers.

    iv'e been on that page a dozen times. it just gets me into an endless loop.
    i need instructions i can understand and do what they tell me to do
    In a message dated 2/18/2015 9:04:06 P.M. Central Standard Time, 
    [email protected] writes:
    i  don't know how to download adobe acrobat reader. could some one please 
    help. i don't know much comp terms
    created by Jerry Klaimon (https://forums.adobe.com/people/Jerry+Klaimon) 
    in Downloading, Installing, Setting Up - View the full  discussion
    (https://forums.adobe.com/message/7208793#7208793)

  • My wife got a Iphone in Bangladesh. she do not know the password for apple ID, there is no way to collect it, as the email id for that iphone is not her. how she can use application store and itunes? please help me

    My wife got a Iphone in Bangladesh. she do not know the password for apple ID, there is no way to collect it, as the email id for that iphone is not her. how she can use application store and itunes? please help me

    If it is second hand, try putting it in recovery mode, and restoring it with itunes on a mac or pc.
    Recovery mode tutoral:http://www.youtube.com/watch?v=dkVr5CxFiFM

  • HT4623 why my device  had "no service" even I already put my sim card..I have follow a few instruction from you tube how to solve this problem but all failed. Please help me .TQ

    why my device  had "no service" ..I have follow a few instruction from you tube how to solve this problem but all failed. Please help me .TQ

    See if anything in this support document help http://support.apple.com/kb/ts4429

  • Hi. I tried switching my Apple ID email address to my new email address and I don't know how to switch it for iCloud and iTunes. Please help!! It seems like Apple thinks I have two separate accounts, when I just tried to simply change it!

    Hi. I tried switching my Apple ID email address to my new email address and I don't know how to switch it for iCloud and iTunes. Please help!! It seems like Apple thinks I have two separate accounts, when I just tried to simply change it!

    Settings > Store > Sign Out.
    Sign in with the correct ID.

  • How to populate a table in the html page from the java script

    Hi all,
    I have doubt in populating a table in the html page. my application is as follows
    I have a html page in which i have a combo box and a table following the combo box.
    i have to populate the table depending on the item selected in the combo box.
    for this i am using javascript to get the value of combo box onClick
    then i have to call some function thru jsp to get the data and then i have to populate the table with thst into from java script
    how can i do this, i.e populating html table from java script
    Thanks in advance
    satya

    Hi Mihai,
    You can populate data in DO_INIT_CONTEXT method of ur impl class in your Z component.
    data:
    lv_struct_ref type ref to YOUR_STRUCTURE,
    lv_value_node type ref to cl_bsp_wd_value_node,
    lv_bo_coll type ref to if_bol_bo_col.
    Data: current type ref to if_bol_bo_property_access.
    data: dref type ref to data.
    data: lv_guid_h type crmt_object_guid.
    data: lt_attr type table of YOUR_STRUCTURE.
    data: ls_attr type YOUR_STRUCTURE.
    data: lr_entity type ref to cl_crm_bol_entity.
    create object lv_bo_coll type cl_crm_bol_bo_col.
    lt_attr is ur internal table.
    Loop at lt_attr into ls_attr.
      create data lv_struct_ref.
      create object lv_value_node
           exporting
                iv_data_ref = lv_struct_ref.
    call method lv_value_node->if_bol_bo_property_access~set_property
    exporting
    iv_attr_name = 'YOURFIELDNAME1'
    iv_value = ls_attr-firstname.
    call method lv_value_node->if_bol_bo_property_access~set_property
    exporting
    iv_attr_name = ' YOURFIELDNAME2'
    iv_value = ls_attr-lastname.
    lv_bo_coll->add( lv_value_node ).
    typed_context->YOURCONTEXTNODE->set_collection( lv_bo_coll ).
    endloop.
    Regards,
    Raghu

Maybe you are looking for

  • IPod Touch 2nd gen deleted all of my pictures?

    My iPod touch 2nd gen 8gb had 150 of my photos on it. I went to view my photos on it and they were all gone! nothing else was deleted besides my photos. I have my photos on my Mac, but why did this happen?

  • Unicode export:Table-splitting and package splitting

    Hi SAP experts, I know there are lot of forums related to this topic, but I have some new questions and hence posting a new thread. We are in the process of doing unicode conversion in our landscape(CRM 7.0 system based on NW 7.01) and we are running

  • Black screen after lid closed

    My ibook g4's screen goes black after the lid is closed. It will wake up normally after entering energy saving mode. When I lift the lid the screen flickers before it turns black. Is the kind of thing that happens when the reed switch needs replaced?

  • Authorizations and roles

    Hi all!! Im creating an authorization object; for restrict some key figures of infocube. I want to restrict only four or five key figures for one cube and the user can see all the characteristics; is possible to do this?? I found this way; but really

  • Shift+A not working

    The machine is a Macbook with 2GHz and 1GB ram. Shift+A is not working. The shift key will work when capitalizing any of the other letters except A. Anyone know what this problem is?