Javascript - Html kodları

Aşağıdaki kodları <body> kodundan sonra istediğiniz bir yere yapıştırın.

{codecitation class="brush: xml; gutter: false;" width="500px"}
<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)?"İYİ GECELER":(hours<10)?"GÜNAYDIN":((hours<12)?"İYİ GÜNLER":((hours<18)?"İYİ AKŞAMLAR":((hours<23)?"İYİ GECELER":"İYİ GECELER"))))

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

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

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

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

var timeValue3 = "TARİH " + datum + "/"

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

// timeValue3 += ((month=0)?"January":((month=1)?"February":((month=2)?"March":((month=3)?"April":((month=4)?"May":((month=5)?"June":((month=6)?"July":((month=7)?"August":((month=8)?"September":((month=9)?"October":((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>

</p>


{/codecitation}



Örnek demo için tıklayın >>