Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Center a Script

  1. #1
    Join Date
    Jun 2007
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Center a Script

    I put: http://www.dynamicdrive.com/dynamicindex6/clock2.htm

    On my website and it works great, but I had a question about it.

    How can I center it? So it shows up in the middle not the left side?

    Also, if someone is from a different time zone, will this get their time zone and display the time in their time zone?

    Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You could put it inside an element that is the same width as the clock and that is in the center of the page - like a table cell or a division. However, this sort of thing can be a bit tricky and often depends upon your DOCTYPE and the rest of your HTML markup and styles.

    If you need more help with this, a link to your page would be a bonus.

    The time shown is the time on the user's machine.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2007
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sweet, Thanks for the reply John.

    www.biblicalmission.com

    Thats the site, as you can see its at the top.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I think you have much bigger problems than centering the time. In IE 6 and 7 it doesn't show up at all. However, in FF you can see it and for that browser and other non-IE browsers you can, in your styles.css file (addition red):

    Code:
    #subheader {
      padding: 0;
      background-color: #FFF;
      text-align:center;
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jun 2007
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hmmm, I didn't touch the code though. I did what it told me to do, but I think this is a problem with Drupal (The company I bought the website from)

    I am soon going to buy another site from else where.


    Thanks for telling me how to center it, appreciate it.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well, actually you didn't follow the instructions quite right. Where it said:

    Step 2: Inside the <BODY> tag itself, throw in the following onLoad event handler, as follows:
    <body onLoad="show_clock()">
    You added this:

    Code:
    <script language="javascript" src="http://www.biblical-education.com/DynamicDrive/liveclock.js">
    
    /*
    Live Clock Script-
    By Mark Plachetta (astro@bigpond.net.auŠ) based on code from DynamicDrive.com
    For full source code, 100's more DHTML scripts, and Terms Of Use,
    visit http://www.dynamicdrive.com
    */
    
    </script><p><body onLoad="show_clock()"></p>
    Get rid of that (all of the red stuff above), and add it to the existing body tag (the one and only one allowed per page) here, like so (addition green):

    Code:
    <link rel="shortcut icon" href="/misc/favicon.ico" type="image/x-icon" />
      <style type="text/css" media="all">@import "/themes/goldengray/style.css";</style>  <script type="text/javascript"> </script>
    </head>
    
    <body onLoad="show_clock()">
    
    <table border="0" cellpadding="0" cellspacing="0" id="header">
      <tr>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Jun 2007
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ah, now it works. My fault, thank you


    When I open it with IE it says "Stack overflow at line:0"

    What does that mean?

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It means that you have a stack overflow. Probably some sort of repetitive routine that is running longer than intended/designed. However, since you haven't updated the live page yet, I cannot be any more specific.

    Incidentally, when I made the recommended changes to your page locally, I got no such error in IE.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Jun 2007
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    However, since you haven't updated the live page yet, I cannot be any more specific.

    Incidentally, when I made the recommended changes to your page locally, I got no such error in IE.

    What do you mean I haven't updated the live page?

  10. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by WebMaker12 View Post
    What do you mean I haven't updated the live page?
    At the moment still, this page:

    http://www.biblicalmission.com/

    has not been updated to reflect any of the changes we discussed.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •