...

View Full Version : No time, all the time!



effpeetee
05-08-2007, 11:17 AM
I cannot get the webpage to put up the two clocks.
<script type="text/javascript" src="ind2clox.js"></script>

I'm getting desperate.

http://www.exitfegs.co.uk/openpage.html
http://www.exitfegs.co.uk/openpagestyles.css

any help please.

effpeetee

rwedge
05-08-2007, 12:54 PM
I do not find a javascript file at http://www.exitfegs.co.uk/ind2clox.js nor a reference to the clocks ids '#clockbox0' '#clockbox1' in the html

effpeetee
05-08-2007, 01:17 PM
I do not find a javascript file at http://www.exitfegs.co.uk/ind2clox.js nor a reference to the clocks ids '#clockbox0' '#clockbox1' in the html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Refresh" content="45" />
<link rel="stylesheet" type="text/css" href="openpagestyles.css" />
<title>Website/Page Title</title>
<script type="text/javascript" src="ind2clox.js"></script>
<script type="text/javascript" src="imageswap.js"></script>
</head>
<body>
<div id="wrap">
<div id="header">
<h1>Page title</h1>
</div>
<div id="content">

This is the beginning of the HTML program.

And here is the beginning of the style sheet.
#clockbox0{
position: absolute;
color:white
}

#clockbox1{
position: absolute;
right: 1em;
color:white }

#wrap {
position: relative;
width: 1000px;
margin: 1 auto;
}


body {
background-color: #000000;
font-family: Arial, Helvetica, sans-serif;
color: white;
font-weight: bold;
font-size:12px
}


Is this wrong. I thought that the latter should/could be in the style sheet.

Be wary, not to click the picture in the HTML.
It is programmed to direct you to a simlar page which is not relevant.

ind2clox.js is on the site. I have just checked it.


effpeetee.

rwedge
05-08-2007, 01:53 PM
You can use style to control the looks and position, but then you need to add the clock division/span to the html

#clockbox0{
position: absolute;
color:white
}

then in the html, the 'target' of the css:

<div id="clockbox0"> </div>

kosstr12
05-08-2007, 01:56 PM
I just thought you might want to know, on http://www.exitfegs.co.uk/xmas2006.html the text from the picture, and the text on the page are to the point where you cant read them

effpeetee
05-08-2007, 02:34 PM
You can use style to control the looks and position, but then you need to add the clock division/span to the html

#clockbox0{
position: absolute;
color:white
}

then in the html, the 'target' of the css:

<div id="clockbox0"> </div>


Thanks. I have done some modifications to the page, but they do not work.
If you look at my index page, you will find that the procedure there works fine. I can't see why it does not work in this "openpage"

index page here.

www.exitfegs.co.uk

Arty Effem
05-08-2007, 03:07 PM
Thanks. I have done some modifications to the page, but they do not work.
If you look at my index page, you will find that the procedure there works fine. I can't see why it does not work in this "openpage"

index page here.

www.exitfegs.co.ukAs you were told initially, you still have no element with the id 'clockbox', to which the script expects to write. Normally this would cause an error, however the clock script cannot run because it is triggered in an onload handler that is overwritten by your image swap script.
You need to comment-out the window.onload assignment in both scripts, and include both function calls in an onload handler preferably in the document itself.

<body onload="GetClock();showimage();" ..........>

rwedge
05-08-2007, 03:30 PM
The image swap script is keeping the clocks from showing.
If you disable it the clocks show.

effpeetee
05-08-2007, 04:10 PM
Yes I think I understand. But why does it work on the present Index page at

www.exitfegs.co.uk

effpeetee.

effpeetee
05-08-2007, 04:22 PM
Thank you,
But no matter where I put the onload; it does not work.

Both of the j'scripts are in the one that works.
What is different about this one?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="refresh" content="45" />
<link rel="stylesheet" type="text/css" href="styles.css" />

<title>index</title>
<style type="text/css">
h1,h2 {font-family: Arial;}
h1,h2 {color:red}
h6 {color:cyan}
h6,h5,h4,h3,h2,h1 {
margin: 0;
}

</style>

]<script type="text/JAVASCRIPT" src="ind2clox.js">[/COLOR]</script>
<script type="text/javascript">

function greet() {
var todaydate = new Date();
var timeis = todaydate.getTime();
todaydate.setTime(timeis);
var houris = todaydate.getHours();
if (houris >17) display = "Evening";
else if (houris >11) display = "Afternoon";
else display = "Morning";
var title = document.title;
var welcome = ("Good " + display + ". Welcome to the Taylor Website");
document.write(welcome);
}

</script>
</head>

<body>
<div id="wrap">

<span id="clockbox0"></span><span id="clockbox1"></span><br />
<span id="greet"></span>

<center>
<h2>
<script type="text/javascript">

greet();

</script></h2>

</center><br />
<br />
<br />
Some pictures are hyperlinks.<br />
They move on to a new picture.<br />
Click them and see!
<div style= "Z-INDEX: 101; LEFT: 94px; WIDTH: 800px; POSITION: absolute; TOP: 49px; HEIGHT: 25px">
<center>
<script type="text/JAVASCRIPT" src=
"indmain.js"></script>
</center>
</div><br />
<br />
Just a bit of family fun.<br />
Don't take it too seriously.<br />
Enjoy.
<br />
<br />
<div style= "Z-INDEX: 101; LEFT: 252px; WIDTH: 770px; POSITION: absolute; TOP: 690px; HEIGHT: 21px">
<center>
The picture is randomly selected and will change every 45 seconds.&nbsp; Pressing the F5 key will also change it.<br />
Clicking the screen picture will enlarge it and keep it on screen until you choose to move on.</center></div>

<a href="two.html">Betty and Frank.</a><br />
<a href="three.html">Little Ted and Dmitri.</a><br />
<a href="four.html">Lovely Betty and Pussycat.</a><br />
<a href="five.html">Betty and the Bears.</a><br />
<a href="seven.html">Steven and Joyce and Mark.</a><br />
<a href="twelve.html">Ritcroft family group.</a><br />
<a href="Eddie.html">Eddie, relaxing at home.</a><br />
<a href="Bluebell1.html">Steven at ease.</a><br />
<a href="Steveintrain.html">Steve on the "Bluebell Line".</a><br />
<a href="steveviewing.html">Steve at the box.</a><br />
<a href="dadatpub.html">'Smile please'</a><br />
<a href="Barker.html">Claire,Yvonne and Susan.</a><br />
<a href="xmas2006.html">Christmas 2006 at Yvonne's.</a><br />
<a href="nine.html">Family photos.</a><br />
<a href="hol1.html">Holiday snaps.</a><br />
<a href="LittleBoyBlue.html">Little Boy Blue</a><br />
<a href="Tarantella.html">Do you remember an inn.</a><br />
<h6>(One of Betty's favourite poems.)</h6>
<a href="openpage.html">openpage.html</a>
<br />
<a href="Picchoose.html"><span class="t14ac">Picture Menu.</span></a>
<br />
<a href="Latest.html">Recently Added Picture(s).</a><br />
<a href="aaind.html">Random pictures - full screen.</a><br /><br />

Website Builder - Frank Taylor<br />
Assisted by Claire Barker.<br />
Checked with Internet Explorer 7.<br />
<span class="t14w">Set to:- 1024 x 768 pixels.</span><br />
<a href= "http://www.mmaus.com/Bestaddress.html"></a>BetterAddress HTML editor<br />
Updated 8th May,2007
</div>
</body>

</html>

effpeetee.

rwedge
05-09-2007, 02:41 AM
The reason the index page works is because the image swap script uses document.write to produce the image HTML,
where as, in openpage.html the imageswap.js script uses DOM to create the image HTML and is called with a onload function.

If you want to verify that the clock script can run on openpage, add the spans for the clockboxes like you have
in your index page and stick a link calling the clock script
<span id="clockbox0"></span><span id="clockbox1"></span><br />
<a href="javascript:GetClock()">Start Clock</a>


As Arty stated, the two external scripts each use their own onload to start and thats causing your problem. Remove the onload functions in the external scripts and add the onload event handler to the body tag to call the scripts one after the other. I know you said you have tried it , but the page doesn't reflect it. It will continue to fail with the two onloads.

effpeetee
05-09-2007, 07:11 AM
Thank you for your very clear explanation. I can now see the problem and I'll modify the code accordingly.
I am now trying switch to using dynamic HTML and it is a bit of an up hill struggle. However, it is rewarding and I thank you all for your patience.

I have only just realised that none of my pages except the index, have a doctype on them.
That should keep me busy for a while.

There are over two hundred of them.

effpeetee.

effpeetee
05-10-2007, 10:59 AM
RWEDGE

I have tried the things that you suggest, but to no avail.
You mention Documeny write as the reason that my index page works; but Document write is about the Greeting line "Good Morning - Welcome etc"

The two things that apparently clash in openpage are both javascripts'

I will quite understand if you think this thread has gone on long enough, but I would dearly like to know why the anomoly exists.

effpeetee

www.exitfegs.co.uk

<title>Website/Page Title</title>
<script type="text/javascript" src="ind2clox.js"></script>
<script type="text/javascript" src="indmain.js"></script>
function greet() {
var todaydate = new Date();
var timeis = todaydate.getTime();
todaydate.setTime(timeis);
var houris = todaydate.getHours();
if (houris >17) display = "Evening";
else if (houris >11) display = "Afternoon";
else display = "Morning";
var title = document.title;
var welcome = ("Good " + display + ". Welcome to the Taylor Website");
document.write(welcome);}</script>

VIPStephan
05-10-2007, 11:36 AM
Hey effpeetee,

In the file(s) I attached in my post (http://codingforums.com/showpost.php?p=564311&postcount=15) in the other thread Iíve rectified the JavaScript so the function calls arenít overwriting themselves. Have you checked that out? You only need that one JS file and include the clockbox elements.

effpeetee
05-10-2007, 01:48 PM
Hello VIPStephan

Check out

www.exitfegs.co.uk

Look at bottom left credit.

effpeetee

Very grateful for all the help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum