JavaScript
Главная
Вход
Регистрация

JavaScript — объектно-ориентированный

скриптовый язык программирования.

Меню сайта

Категории раздела
Разное [14]
Иконки [1]
Приветствие [7]
Кодировщики [6]
Фото эффекты [6]
Хитрые скрипты [10]
Фрейм JavaScript [2]
Формат файла .js [1]
Эффекты с окнами [4]
Звуковые эффекты [4]
Ссылки и эффекты [12]
Текстовые эффекты [28]
Кнопки с эффектами [12]
Визуальные эффекты [10]
Эффекты с курсорами [6]
Онлайн генератор ников и паролей [2]
Софт, программы, скачать [15]

Главная » Файлы » Разное

Рулетка цветов
28.07.2010, 21:03



Нажать "X" для остановки.

Цвет фона =

Код:
   <!-- Вставьте эту часть кода между тегами <HEAD></HEAD> вашего документа -->



<SCRIPT LANGUAGE="JavaScript">



<!-- Begin
color=new Array("0","8","F");
speed=250;
document.bgColor="FFFFFF";
bg=new Array("FFFFFF","FFFFFF","FFFFFF");
function begin() {
document.form.col1.value=" X "; document.form.col2.value=" X ";
document.form.col3.value=" X "; i=0; roll(speed);
}
function roll(speedB) {
if (document.form.col1.value==" X ") {
document.form.c1.value=document.form.b1.value;
document.form.b1.value=document.form.a1.value;
document.form.a1.value=
color[Math.round(Math.random()*10)%3]+
color[Math.round(Math.random()*10)%3];
}
if (document.form.col2.value==" X ") {
document.form.c2.value=document.form.b2.value;
document.form.b2.value=document.form.a2.value;
document.form.a2.value=
color[Math.round(Math.random()*10)%3]+
color[Math.round(Math.random()*10)%3];
}
if (document.form.col3.value==" X ") {
document.form.c3.value=document.form.b3.value;
document.form.b3.value=document.form.a3.value;
document.form.a3.value=
color[Math.round(Math.random()*10)%3]+
color[Math.round(Math.random()*10)%3];
}
setTimeout("roll("+speedB+")",speedB);
}
function stop(col) {
if (col==1) {document.form.col1.value=" ";i++;}
if (col==2) {document.form.col2.value=" ";i++;}
if (col==3) {document.form.col3.value=" ";i++;}
if (i==3) {
bg[0]=document.form.a1.value+
document.form.a2.value+
document.form.a3.value;
bg[1]=document.form.b1.value+
document.form.b2.value+
document.form.b3.value;
bg[2]=document.form.c1.value+
document.form.c2.value+
document.form.c3.value;
speedB=500000;roll(speedB);
}
}
function view(letter) {
document.bgColor=bg[letter];
document.form.color.value="#"+bg[letter];
}
// End -->
</script>


<!-- Вставьте эту часть кода в html документ -->

<center>
<form name="form">
<table cellpadding="2">
<tbody><tr><td align="center">
<input type="text" name="a1" size="2" onfocus="this.blur()" value=" ">
<input type="text" name="a2" size="2" onfocus="this.blur()" value=" ">
<input type="text" name="a3" size="2" onfocus="this.blur()" value=" ">
<input type="button" onclick="view(0)" value="Показать"><br>
<input type="text" name="b1" size="2" onfocus="this.blur()" value=" ">
<input type="text" name="b2" size="2" onfocus="this.blur()" value=" ">
<input type="text" name="b3" size="2" onfocus="this.blur()" value=" ">
<input type="button" onclick="view(1)" value="Показать"><br>
<input type="text" name="c1" size="2" onfocus="this.blur()" value=" ">
<input type="text" name="c2" size="2" onfocus="this.blur()" value=" ">
<input type="text" name="c3" size="2" onfocus="this.blur()" value=" ">
<input type="button" onclick="view(2)" value="Показать"><br>
<input type="button" onclick="stop(1)" value=" X " name="col1">
<input type="button" onclick="stop(2)" value=" X " name="col2">
<input type="button" onclick="stop(3)" value=" X " name="col3">
</td>
<td valign="middle" align="center">
<input type="button" onclick="begin()" value="Начать"><p>
<table bgcolor="FFFFFF" border="1" cellspacing="0">
<tbody><tr><td align="center" valign="middle">Нажать "X" для остановки.<p>
Цвет фона = <input type="text" size="7" value="#FFFFFF" name="color">
</td></tr>
</tbody></table>
</td></tr>
</tbody></table>
</form>
</center>
Категория: Разное | Добавил: Besigor
Просмотров: 1955 | Загрузок: 0 | Рейтинг: 0.0/0
Всего комментариев: 0
avatar
ONLINE
Онлайн всего: 1
Гостей: 1
Пользователей: 0

Статистика




Бесплатные JavaScript © 2024