Jump to content
  • 0

изменять параметры текста со временной переменной


Rilo
 Share

Question

5 answers to this question

Recommended Posts

  • 0
как сделать, чтобы параметры текста (размер, цвет) изменяли их характеристики через определённое количество времени (например, каждые 2 секунды)?

повесить таймер и с интервалом 2 секунды изменять по таймеру характеристики.

Link to comment
Share on other sites

  • 0

Spetsialno dlya vas...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<script type="text/javascript">
<!--//
var colors = ['#00ced1','#696969','#006400','#483d8b','#556b2f','#0000cd','#1e90ff','#ff0000'];
var indexs = 0;

function changetextcolor(){
if(document.getElementById){
document.getElementById('texts').style.color = colors[indexs];
if(indexs>colors.length-1){
indexs = 0;
}else{
indexs ++;
}


setTimeout('changetextcolor()', 500);
}
}



//-->
</script>


<body onLoad="changetextcolor()">

<div id="texts">Application</div>




</body>
</html>

Link to comment
Share on other sites

  • 0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Template</title>
<meta http-equiv="content-type" content="text/html; charset=windows-1251">
<style type="text/css">
.cl {
font:9px Verdana;
color:rgb(10,10,10);
}
.cl-0 {
font:11px Verdana;
color:rgb(255,69,0);
}
.cl-1 {
font:13px Verdana;
color:rgb(185,0,0);
}
.cl-2 {
font:17px Verdana;
color:rgb(151,82,106);
}
.cl-3 {
font:bold 22px Georgia;
color:rgb(144,192,85);
}
.cl-4 {
font:bold 111px Georgia;
color:rgb(17,107,165);
}
</style>

<script type="text/javascript">
function rever(){
var t = document.getElementById("d0");
t.className='cl-'+Math.round(Math.random() * 4)+'';
}
setInterval('rever()', 2000);
</script>

</head>
<body>

<div class="cl" id="d0">Пример текста!</div>

</body>
</html>

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