klok werkt niet

Status
Niet open voor verdere reacties.

whisper380

Terugkerende gebruiker
Lid geworden
12 jan 2009
Berichten
1.247
ik weet niet of hij hier goed staat maar ik krijg m'n klok niet goed werkend.

ik heb via een handleiding een klok gemaakt maar nu klopt de datum niet helemaal.
inplaats van 2010 geeft hij 110 aan waar ligt dit aan?

hier bij de code:
Code:
<SCRIPT>

<!--  HIDE ME FROM THAT BROWSER  -- !>

var timerID = null

var timerRunning = false



function stopclock(){

    // cannot directly test timerID on DEC OSF/1 in beta 4.

    if(timerRunning)

        clearTimeout(timerID)

    timerRunning = false

}



function startclock(){

     // Make sure the clock is stopped

    stopclock()

    showtime()

}



function showtime(){

    var now = new Date()

    var hours = now.getHours()

    var minutes = now.getMinutes()

    var seconds = now.getSeconds()

    var month = now.getMonth()

    var datum = now.getDate()

    var year = now.getYear()

    var timeValue = ((hours<4)?"Goede nacht":(hours<10)?"Goedemorgen":((hours<12)?"Goedendag":((hours<18)?"Goedemiddag":((hours<23)?"Goedenavond":"Goede nacht"))))

    var timeValue2 = "Het is: " + ((hours > 12) ? hours - 12 : hours)

    timeValue2 += ((minutes < 10) ? ":0" : ":") + minutes

    timeValue2 += ((seconds < 10) ? ":0" : ":") + seconds

    timeValue2 += (hours >= 12) ? " P.M." : " A.M."

    var timeValue3 = "Op " + datum + "/"

    timeValue3 += (((month + 1) < 10) ? "0" : "") + (month + 1)

//    timeValue3 += ((month=0)?"Januari":((month=1)?"Februari":((month=2)?"Maart":((month=3)?"April":((month=4)?"Mei":((month=5)?"Juni":((month=6)?"Juli":((month=7)?"Augustus":((month=8)?"September":((month=9)?"Oktober":((month=10)?"November":((month=11)?"December":(("month=12"))))))))))))

       timeValue3 += "/" + "'" + year

//    timeValue3 += ((seconds < 10) ? ":0" : ":") + seconds

//    timeValue3 += (hours >= 12) ? " P.M." : " A.M."

    

    document.clock.face.value = timeValue

    document.clock.face2.value = timeValue2

    document.clock.face3.value = timeValue3

    timerID = setTimeout("showtime()",1000)

    timerRunning = true

}

//-->



</SCRIPT>


<BODY TEXT="#000080" onLoad="startclock()">

<FORM NAME="clock" onSubmit="0">

<INPUT TYPE="text" NAME="face" SIZE=20 VALUE ="">

<INPUT TYPE="text" NAME="face2" SIZE=20 VALUE ="">

<INPUT TYPE="text" NAME="face3" SIZE=20 VALUE ="">

</FORM>

<!-- Einde van de code -->
hoplijk kunnen jullie me helpen.
 
Laatst bewerkt:
Als ik dit in een HTML-bestand zet, werkt het, de tijd loopt :

Goedemiddag Het is: 12:27:03 P.M. Op 15/06/'2010

De ' voor 2010 staat er ook, dus geen fout van mij.
 
Laatst bewerkt:
Bij mij werkt hij niet, bij mij komt er '110 te staan
html document gemaakt en nog steeds het zelfde:
code:
Code:
<html>
<head>

<SCRIPT>

<!--  HIDE ME FROM THAT BROWSER  -- !>

var timerID = null

var timerRunning = false



function stopclock(){

    // cannot directly test timerID on DEC OSF/1 in beta 4.

    if(timerRunning)

        clearTimeout(timerID)

    timerRunning = false

}



function startclock(){

     // Make sure the clock is stopped

    stopclock()

    showtime()

}



function showtime(){

    var now = new Date()

    var hours = now.getHours()

    var minutes = now.getMinutes()

    var seconds = now.getSeconds()

    var month = now.getMonth()

    var datum = now.getDate()

    var year = now.getYear()

    var timeValue = ((hours<4)?"Goede nacht":(hours<10)?"Goedemorgen":((hours<12)?"Goedendag":((hours<18)?"Goedemiddag":((hours<23)?"Goedenavond":"Goede nacht"))))

    var timeValue2 = "Het is: " + ((hours > 12) ? hours - 12 : hours)

    timeValue2 += ((minutes < 10) ? ":0" : ":") + minutes

    timeValue2 += ((seconds < 10) ? ":0" : ":") + seconds

    timeValue2 += (hours >= 12) ? " P.M." : " A.M."

    var timeValue3 = "Op " + datum + "/"

    timeValue3 += (((month + 1) < 10) ? "0" : "") + (month + 1)

//    timeValue3 += ((month=0)?"Januari":((month=1)?"Februari":((month=2)?"Maart":((month=3)?"April":((month=4)?"Mei":((month=5)?"Juni":((month=6)?"Juli":((month=7)?"Augustus":((month=8)?"September":((month=9)?"Oktober":((month=10)?"November":((month=11)?"December":(("month=12"))))))))))))

       timeValue3 += "/" + "'" + year

//    timeValue3 += ((seconds < 10) ? ":0" : ":") + seconds

//    timeValue3 += (hours >= 12) ? " P.M." : " A.M."

    

    document.clock.face.value = timeValue

    document.clock.face2.value = timeValue2

    document.clock.face3.value = timeValue3

    timerID = setTimeout("showtime()",1000)

    timerRunning = true

}

//-->



</SCRIPT>
</head>

<body>

<BODY TEXT="#000080" onLoad="startclock()">

<FORM NAME="clock" onSubmit="0">

<INPUT TYPE="text" NAME="face" SIZE=20 VALUE ="">

<INPUT TYPE="text" NAME="face2" SIZE=20 VALUE ="">

<INPUT TYPE="text" NAME="face3" SIZE=20 VALUE ="">

</FORM>
</body>

<!-- Einde van de code -->
</HTML>
 
Laatst bewerkt:
hij werkt wel in internet explorer maar niet in chrome en firefox iemand een oplossing hiervoor?
 
Vreemde zaak, lijkt af te hangen van de browser. IE8 werkt normaal, maar met Opera, FF en Chrome krijg je '110.
 
Helaas niet, anders had ik die wel gegeven. Maar ik verwacht dat er toch iemand zal zijn die het wel weet.
 
Klok

Deze werkt, lijkt erop dat je javascript moet gebruiken :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" x-undefined="" />

</head>

<body onload="javascript:timedate();">

<body>

<center>
<script language="JavaScript">
<!--

var TString, DString;
function timedate(){now=new Date();
H=now.getHours();
M=now.getMinutes();
S=now.getSeconds();
TString="" + H; TString+=((M < 10) ? ":0" : ":")+M;
TString+=((S < 10) ? ":0" : ":")+S;
document.clock.time.value = TString;
Day=now.getDate();
month = now.getMonth()+1;
year=now.getYear();
if (year< 2000) year+=1900
DString = "" + Day;
DString+=((month<10) ? ".0" : ".") + month;
DString+="." + year;
document.clock.date.value = DString;
Timer=setTimeout("timedate()", 1000);}

//-->
</script> </p>

<form name="clock">
<div align="center"><center><p><input type="text" name="date" size="10" value> <input
type="text" name="time" size="8" value> </p>
</center></div>
</form>



</body>

</html>
 
Laatst bewerkt:
maar ik wil wel dat goedemorgen etc erbij hebben. kunt u dat er in verwerken?
 
Ja, dat kan. Dat moet je e.e.a. aanpassen. Ik heb nu weinig tijd, dus moet je dat zelf proberen.
 
heb nu het eerste bestandje een klein beetje aangepast en nu doet hij het wel. het enige nadeel is dat je elk jaar het jaar bij moet werken.
Code:
<SCRIPT>

<!--  HIDE ME FROM THAT BROWSER  -- !>

var timerID = null

var timerRunning = false



function stopclock(){

    // cannot directly test timerID on DEC OSF/1 in beta 4.

    if(timerRunning)

        clearTimeout(timerID)

    timerRunning = false

}



function startclock(){

     // Make sure the clock is stopped

    stopclock()

    showtime()

}



function showtime(){

    var now = new Date()

    var hours = now.getHours()

    var minutes = now.getMinutes()

    var seconds = now.getSeconds()

    var month = now.getMonth()

    var datum = now.getDate()

    var year = now.getYear()

    var timeValue = ((hours<4)?"Goede nacht":(hours<10)?"Goedemorgen":((hours<12)?"Goedendag":((hours<18)?"Goedemiddag":((hours<23)?"Goedenavond":"Goede nacht"))))

    var timeValue2 = "Het is: " + ((hours > 12) ? hours - 12 : hours)

    timeValue2 += ((minutes < 10) ? ":0" : ":") + minutes

    timeValue2 += ((seconds < 10) ? ":0" : ":") + seconds

    timeValue2 += (hours >= 12) ? " P.M." : " A.M."

    var timeValue3 = "Op " + datum + "/"

    timeValue3 += (((month + 1) < 10) ? "0" : "") + (month + 1)

//    timeValue3 += ((month=0)?"Januari":((month=1)?"Februari":((month=2)?"Maart":((month=3)?"April":((month=4)?"Mei":((month=5)?"Juni":((month=6)?"Juli":((month=7)?"Augustus":((month=8)?"September":((month=9)?"Oktober":((month=10)?"November":((month=11)?"December":(("month=12"))))))))))))

       timeValue3 += "/" + "'" + 2010

//    timeValue3 += ((seconds < 10) ? ":0" : ":") + seconds

//    timeValue3 += (hours >= 12) ? " P.M." : " A.M."

    

    document.clock.face.value = timeValue

    document.clock.face2.value = timeValue2

    document.clock.face3.value = timeValue3

    timerID = setTimeout("showtime()",1000)

    timerRunning = true

}

//-->



</SCRIPT>

<BODY TEXT="#000080" onLoad="startclock()">

<FORM NAME="clock" onSubmit="0">

<INPUT TYPE="text" NAME="face" SIZE=20 VALUE ="">

<INPUT TYPE="text" NAME="face2" SIZE=20 VALUE ="">

<INPUT TYPE="text" NAME="face3" SIZE=20 VALUE ="">

</FORM>

<!-- Einde van de code -->

year is 2010 geworden
 
Laatst bewerkt:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan