PDA

View Full Version : Center a Script



WebMaker12
06-23-2007, 10:47 PM
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

jscheuer1
06-24-2007, 02:33 AM
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.

WebMaker12
06-24-2007, 02:54 AM
Sweet, Thanks for the reply John.

www.biblicalmission.com

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

jscheuer1
06-24-2007, 03:27 AM
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):


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

WebMaker12
06-24-2007, 03:29 AM
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.

jscheuer1
06-24-2007, 03:42 AM
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:


<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):


<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>

WebMaker12
06-24-2007, 03:46 AM
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?

jscheuer1
06-24-2007, 03:55 AM
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.

WebMaker12
06-24-2007, 01:56 PM
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?

jscheuer1
06-24-2007, 04:04 PM
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.

WebMaker12
06-25-2007, 05:06 PM
I changed them, but I am having a problem with changes appearing...

I e-mailed Drupal (The company who I bought the site from) and they said they don't know what to say. (Great Company? Eh) Tons of other people are having the same problem with changes being saved. Anyhow I will figure out what the problem is with the site about changing things, and get back to you.

Thank you for your time and help.

jscheuer1
06-25-2007, 05:30 PM
This change/addition has shown up in the live page:


<b><font color="Red"><a href="javascript:bookmarksite('Biblical Mission', 'http://www.biblicalmission.com')">Click here to add this site to your Favorites</font></a><br />
</b><br />

But, not the ones I suggested. I have no idea what the story with your host is. However, if you upload a page and clear your cache before viewing it again, the changes will most likely be in evidence. But, if you make changes live (through some kind of host interface), without uploading a new/changed file, this could be the problem.