Jump to content
  • 0

Шрифт в javascript


alessandrou
 Share

Question

Здравствуйте! Помогите, пожалуйста, найти то место, где в этом коде можно поменять цвет цифр.

Вот код:<script language='javascript' type='text/javascript'>

function fulltime () {

var time=new Date();

var newYear=new Date("jan,01,2011,00:00:00");

var totalRemains=(newYear.getTime()-time.getTime());

if (totalRemains>1){

var RemainsSec = (parseInt(totalRemains/1000));

var RemainsFullDays=(parseInt(RemainsSec/(24*60*60)));

var secInLastDay=RemainsSec-RemainsFullDays*24*3600;

var RemainsFullHours=(parseInt(secInLastDay/3600));

if (RemainsFullHours<10){RemainsFullHours="0"+RemainsFullHours};

var secInLastHour=secInLastDay-RemainsFullHours*3600;

var RemainsMinutes=(parseInt(secInLastHour/60));

if (RemainsMinutes<10){RemainsMinutes="0"+RemainsMinutes};

var lastSec=secInLastHour-RemainsMinutes*60;

if (lastSec<10){lastSec="0"+lastSec};

document.getElementById("RemainsFullDays").innerHTML=RemainsFullDays+"<span id='Rem'> дн</span>";

document.getElementById("RemainsFullHours").innerHTML=RemainsFullHours+"<span id='Rem'> час</span>";

document.getElementById("RemainsMinutes").innerHTML=RemainsMinutes+"<span id='Rem'> мин</span>";

document.getElementById("lastSec").innerHTML=lastSec+"<span id='Rem'> сек</span>";

setTimeout('fulltime()',10)

}

else{

document.getElementById("clock").innerHTML="C НОВЫМ ГОДОМ !!!";

}

}

</script>

<style type='text/css'>

#clou_xs {position:relative;width:200px;height:150px;padding:10px;}

#clock {height:150px;text-align:center;font-size:13px;}

#RemainsFullDays {position:absolute;top:50%;left:40%;font-size:25px;}

#RemainsFullHours {position:absolute;bottom:1px;left:40px;font-size:15px;}

#RemainsMinutes {position:absolute;bottom:1px;left:87px;font-size:15px;}

#lastSec {position:absolute;bottom:1px;left:135px;font-size:15px;}

#Rem {font-size:11px;font-weight:normal;}

</style>

<div id='clou_xs'>

<div id='clock'>

до нового года осталось:

<span id='RemainsFullDays'></span>

<span id='RemainsFullHours'></span>

<span id='RemainsMinutes'></span>

<span id='lastSec'></span>

</div>

</div>

<script language='javascript'>fulltime();</script>

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Нету тут такого места. Придется допиливать немного код, что бы получилось изменить цвет цифр и не затронуть остальной текст. Например:

эту часть так:

document.getElementById("RemainsFullDays").innerHTML="<span class='numcolor'>"+RemainsFullDays+"</span><span id='Rem'> дн</span>"; 
document.getElementById("RemainsFullHours").innerHTML="<span class='numcolor'>"+RemainsFullHours+"</span><span id='Rem'> час</span>";
document.getElementById("RemainsMinutes").innerHTML="<span class='numcolor'>"+RemainsMinutes+"</span><span id='Rem'> мин</span>";
document.getElementById("lastSec").innerHTML="<span class='numcolor'>"+lastSec+"</span><span id='Rem'> сек</span>";

и эту так:

<style type='text/css'> 
#clou_xs {position:relative;width:200px;height:150px;padding:10px;}
#clock {height:150px;text-align:center;font-size:13px;}
#RemainsFullDays {position:absolute;top:50%;left:40%;font-size:25px;}
#RemainsFullHours {position:absolute;bottom:1px;left:40px;font-size:15px;}
#RemainsMinutes {position:absolute;bottom:1px;left:87px;font-size:15px;}
#lastSec {position:absolute;bottom:1px;left:135px;font-size:15px;}
#Rem {font-size:11px;font-weight:normal;}
.numcolor {color: red;}
</style>

за цвет будет отвечать вот эта строчка:

.numcolor {color: red;}

Edited by zSpx
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy