час +1

Liberate

Registered
моля ви дайте ми възможно най-простия js код за изписване на часа шот ми писна от некфи кодове с дата седмица ден секунди че даже и некъф календар залепен за часа намерих :shock:

трябва ми js код който просто да изписва "час":"минути" и нищо повече... а да и да може да се настройва фонт-а за шрифта големината и цвета... :)
 
Най-простия



Код:
 <script language = "javascript">




/*    !!!These specifications are supported in both IE and Netscape. You MUST give these variables a value!!!    */


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>
 
archer ти май не прочете кфо искам...
само надписа на часа и то само час и минути
без секунди без дата и без поле отзад - само надписа!
а да и да не е А.М. и Р.М. ! 0-24 да си е часа задължително

леле много съм нахален :D
 
Ето така ;)



Код:
 <script language = "javascript">




/*    !!!These specifications are supported in both IE and Netscape. You MUST give these variables a value!!!    */


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()
	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>
 
archer полето все още си стои :twisted:
sh0ck аз точно такъв код казах да не ми давате бе :D
имам го тоя код и то точно от тоя урок... аз точно от него се опитах да си отделя часа ама нали и аз не съм по javascript-а ... :)
 
Код:
<SCRIPT language="JavaScript">
function startclock()
{
var thetime=new Date();
var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
var AorP=" ";
if (nhours>=12)
    AorP="PM";
else
    AorP="AM";
if (nhours>=13)
    nhours-=12;
if (nhours==0)
   nhours=12;
if (nmins<10)
nmins="0"+nmins;
document.write("Часът е "+nhours+":"+nmins+" "+AorP);
setTimeout('startclock()',1000);
} 
startclock();
</SCRIPT>
 
пак не става :cry:
ми приятел махни го ти и щи дам 1 точка... нали за тфа е темата...
махнах функцията за ам или пм и се прецака цялото :lol:
 
Код:
<script type="text/javascript">


</script>
Ако и това не ти върши работа не знам...и разбери който и да е писал се е опитвал да ти помогне :) [/code]
 
1. не помага шот още от тука виждам ам и пм
2. много добре знам че всеки се опитва да помогне и за тва съм ви благодарен, просто не ме устройват тия часовници :)
 
Код:
 <SCRIPT language="JavaScript">
function startclock()
{
var thetime=new Date();
var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
var AorP=" ";
if (nhours>=12)
    AorP="PM";
else
    AorP="AM";
if (nhours>=13)
    nhours-=12;
if (nhours==0)
   nhours=12;
if (nmins<10)
nmins="0"+nmins;
document.write(" "+nhours+":"+nmins+" "+AorP);
setTimeout('startclock()',1000);
}
startclock();
</SCRIPT>


Използвай на рожденника часовника ;)
 
Код:
 <SCRIPT language="JavaScript"> 
function startclock() 
{ 
var thetime=new Date(); 
var nhours=thetime.getHours(); 
var nmins=thetime.getMinutes(); 
document.write("Часът е "+nhours+":"+nmins); 
} 
startclock(); 
</SCRIPT>
 
хаахахахахахахаха инсайд ти ме уби на място :mrgreen:
точно тфа ми трябва и мойто не ставаше шот го писах така "+nhours+":"+nmins+" а то тряя да е така nhours+":"+nmins :mrgreen:
е тфа е давам ти точката брат ти ме свали от стола :D
некъф идиотски часовник не ставал само заради 2 кавички.... :D :D
+1 :P
 
леле ... сложих си и секунди на тоя код оправих му шрифт и сичко и забелязах 1 - часовника не е динамичен :D тоест за да се подновяват часа минутите и секундите тряя да се рефрешва сайта шот часовника не го прави сам :shock:
нищо аз фанах цаката на 1 код и го разчистих та стана перфектно :P
плюс тва вече му дадох точката на инсайд :)
 

Back
Горе