Как да променя този скрипт?

joreto_88

Registered
Какво трябва да променя, за да го направя в 24-часов режим

Код:
<span id="digitalclock" class="styling"></span>

<script>

var alternate=0
var standardbrowser=!document.all&&!document.getElementById

if (standardbrowser)
document.write('<form name="tick"><input type="text" name="tock" size="11"></form>')

function show(){
if (!standardbrowser)
var clockobj=document.getElementById? document.getElementById("digitalclock") : document.all.digitalclock
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var dn="AM"

if (hours==12) dn="PM" 
if (hours>12){
dn="PM"
hours=hours-12
}
if (hours==0) hours=12
if (hours.toString().length==1)
hours="0"+hours
if (minutes<=9)
minutes="0"+minutes

if (standardbrowser){
if (alternate==0)
document.tick.tock.value=hours+" : "+minutes+" "+dn
else
document.tick.tock.value=hours+" "+minutes+" "+dn
}
else{
if (alternate==0)
clockobj.innerHTML=hours+"<font color='lime'> : </font>"+minutes+" "+"<sup style='font-size:1px'>"+dn+"</sup>"
else
clockobj.innerHTML=hours+"<font color='black'> : </font>"+minutes+" "+"<sup style='font-size:1px'>"+dn+"</sup>"
}
alternate=(alternate==0)? 1 : 0
setTimeout("show()",1000)
}
window.onload=show

</script>

Ако може промените да са в червен цвят
 
Код:
 <script language = "javascript">



var clockwidth = 12              //specify the clock width
var clockvalue = "--- Clock ---" //the text in the clock before the body is completly loaded (needs quotes)




/*        !!!!!extra clock looks only available in IE, not supported in netscape!!!!       */

var clockfeatures = "yes"       // do you want the extra looks? if no, you do not have to change the next 5 variables (must keep quotes around yes/no)

var backcolor = "#000000"       //specify background color (needs quotes)
var textcolor = "#eeeeee"       //specify text color (needs quotes)
var borderstyle = "solid"	//specify the type of border ((in quotes, type "original" for the normal style, regardless of your color and width specs) none,dotted,dashed,solid,double,groove,ridge,inset,outset)
var bordercolor = "#a00000"     //specify border color (needs quotes) (type in 0 for the borderwidth if you dont want one)
var borderwidth = 1             //specify border width (a number in pixels, (type in 0 if you dont want one)
var fontfamily = "Arial"        //specify font type (needs quotes) (type in 'null' if you dont care)


document.onLoad = setInterval('chngtme()',100)

if (document.all && clockfeatures=="yes") {document.write("<style> #clock { background: "+backcolor+"; color: "+textcolor+((borderstyle!='original')?'; border: '+bordercolor+' '+borderwidth+'px '+borderstyle+';':';')+" font-family: "+fontfamily+";} </style>")}
function chngtme() {
	var t=new Date()
	var AP=((t.getHours()>=12)?" P.M.":" A.M.")
	var timeValue=""+((t.getHours()>12)?t.getHours()-12:(t.getHours()==0)?12:t.getHours())
	timeValue+=((t.getMinutes()<10)?":0":":")+t.getMinutes()
	timeValue+=((t.getSeconds()<10)?":0":":")+t.getSeconds()
	timeValue+=AP
	document.clock.face.value=timeValue
}
document.write('<center><form name="clock" Action="#"><input id="clock" TYPE="text" NAME="face" SIZE="'+clockwidth+'" VALUE="'+clockvalue+'"></form></center>')

//-->
</script>
 
Код:
 <script style="text/javascript">
var alternate=0
var standardbrowser=!document.all&&!document.getElementById

if (standardbrowser)
document.write('<form name="tick"><input type="text" name="tock" size="11"></form>')

function show(){
if (!standardbrowser)
var clockobj=document.getElementById? document.getElementById("digitalclock") : document.all.digitalclock
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()


if (hours==12) 

if (hours==0) hours=12
if (hours.toString().length==1)
hours="0"+hours
if (minutes<=9)
minutes="0"+minutes

if (standardbrowser){
if (alternate==0)
document.tick.tock.value=hours+" : "+minutes
else
document.tick.tock.value=hours+" "+minutes
}
else{
if (alternate==0)
clockobj.innerHTML=hours+"<font color='lime'> : </font>"+minutes+" "+"</font>"
else
clockobj.innerHTML=hours+"<font color='black'> : </font>"+minutes+" "+"</font>"
}
alternate=(alternate==0)? 1 : 0
setTimeout("show()",1000)
}
window.onload=show

</script>
<span id="digitalclock" class="styling"></span>
 

Back
Горе