Главная | Форум | Статьи | Фaйлы| Картинки WoW | Профиль | Регистрация | Вход

[ Новые сообщения · Правила форума · Поиск · RSS ]

WoW-Info — информационный World of Warcraft портал

HЕХ-RGB Конвертер - Форум

  • Сторінка 1 з 1
  • 1
HЕХ-RGB Конвертер
HammeRДата: Неділя, 05.12.2010, 03:16 | Сообщение # 1



HammeR
Рыцарь
Группа: Пользователи
Сообщений: 449

Замечания:

Оффлайн
Code
<HEAD>  

<SCRIPT LANGUAGE="JavaScript">  
<!-- Original:  Ryan Sokol -->  
<!-- Web Site:  http://www.logicode.net -->  

<! >  
<! >  

<!-- Begin  
function NumToHex(num1,num2) {  
strNum=document.forms[0].elements[num1].value;  
for(i = 0; i < strNum.length; i++) {  
chr=strNum.substring(i, i + 1);    
if((isNaN(chr))||(chr == ' ')) {  
alert('You must enter a digit between 0 and 9!');  
document.forms[0].elements[num1].select();  
document.forms[0].elements[num2].value='';  
return false;  
     }  
}  
if(strNum > 255) {  
alert('You must enter a number between 0 and 255!');  
document.forms[0].elements[num1].select();  
document.forms[0].elements[num2].value='';  
return false;  
}  
else {  
base = strNum / 16;  
rem = strNum % 16;  
base = base - (rem / 16);  
baseS = MakeHex(base);  
remS = MakeHex(rem);  
document.forms[0].elements[num2].value=baseS + '' + remS;  
ChangeBackground(3, 4, 5);  
return true;  
     }  
}  
function MakeHex(x) {  
if((x >= 0) && (x <= 9))  
return x;  
else {  
switch(x) {  
case 10: return "A";   
case 11: return "B";    
case 12: return "C";    
case 13: return "D";    
case 14: return "E";    
case 15: return "F";    
        }  
     }  
}  
function HexToNum(num1,num2) {  
numberS = document.forms[0].elements[num1].value;  
tens = MakeNum(numberS.substring(0,1));  
if(tens == 'X') {  
document.forms[0].elements[num1].select();  
document.forms[0].elements[num2].value='';  
return false;  
}  
ones = 0;  
if(numberS.length > 1) // means two characters entered  
ones=MakeNum(numberS.substring(1,2));  
if(ones == 'X') {  
document.forms[0].elements[num1].select();  
document.forms[0].elements[num2].value='';  
return false;  
}  
document.forms[0].elements[num2].value = (tens * 16) + (ones * 1);  
document.forms[0].elements[num1].value = document.forms[0].elements[num1].value.toUpperCase();  
ChangeBackground(3, 4, 5);  
return true;  
}  
function MakeNum(str) {  
if((str >= 0) && (str <= 9))  
return str;  
switch(str.toUpperCase()) {  
case "A": return 10;  
case "B": return 11;  
case "C": return 12;  
case "D": return 13;  
case "E": return 14;  
case "F": return 15;  
default:  alert('You must choose a number between 0 and 9 or a letter between A and F!');  
return 'X';  
     }  
}  
function ChangeBackground(num1, num2, num3) {  
document.bgColor = '#'+document.forms[0].elements[num1].value + document.forms[0].elements[num2].value + document.forms[0].elements[num3].value;  
}  
//  End -->  
</script>  

</HEAD>  

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->  

<BODY>  

<form>  
<table border=1 align=center cellpadding=10 bgcolor=white>  
<tr>  
<th>Color/Code</th>  
<th>Red</th>  
<th>Green</th>  
<th>Blue</th>  
</tr>  
<tr>  
<th>0-255</th>  
<td><input type=text name=rr_num size=4 maxlength=3 onKeyUp="return NumToHex(0,3);"></td>  
<td><input type=text name=gg_num size=4 maxlength=3 onKeyUp="return NumToHex(1,4);"></td>  
<td><input type=text name=bb_num size=4 maxlength=3 onKeyUp="return NumToHex(2,5);"></td>  
</tr>  
<tr>  
<th>HEX</th>  
<td><input type=text name=rr_hex size=4 maxlength=2 onKeyUp="return HexToNum(3,0);"></td>  
<td><input type=text name=gg_hex size=4 maxlength=2 onKeyUp="return HexToNum(4,1);"></td>  
<td><input type=text name=bb_hex size=4 maxlength=2 onKeyUp="return HexToNum(5,2);"></td>  
</tr>  
</table>  
</form>


 
  • Сторінка 1 з 1
  • 1
Пошук:

Новые сообщения в темах
Сдам в аренду сервер и хостинг · (Хост Предложения)
Автор: redlaine
Последнее сообщение в 23:53
хаха :D · (Приколы)
Автор: [N1ke]Medved
Последнее сообщение в 18:40
Autobattle - новый боевой бот ... · (Боты для WoW)
Автор: terrikon
Последнее сообщение в 18:39
PvE руководство для Чернокнижн... · (Чернокнижник)
Автор: Darkensand
Последнее сообщение в 18:38
Пустой свиток (Часть 11) · (Истории WoW)
Автор: R_a_Z_o_R
Последнее сообщение в 18:37
Друиды в Катаклизме: Официальн... · (Друид)
Автор: Darkensand
Последнее сообщение в 18:37
[Баг 3.3.5] Фарм ледяных бадже... · (Читы для WoW)
Автор: Darkensand
Последнее сообщение в 18:35
FarmBot (Бот для фарма руды и ... · (Боты для WoW)
Автор: homma
Последнее сообщение в 18:34
Почему мы сражаемся: ролевая и... · (Воин)
Автор: Darkensand
Последнее сообщение в 18:34
Книги по Wold of Warcraft · (Истории WoW)
Автор: R_a_Z_o_R
Последнее сообщение в 18:33
Маг огня в Cataclysm · (Маг)
Автор: Darkensand
Последнее сообщение в 18:33
Как начать играть в World of W... · (Полезно знать)
Автор: Belkmondesh
Последнее сообщение в 18:32
Характеризация профессий · (Профессии)
Автор: Darkensand
Последнее сообщение в 18:31
Что значит для арканов бета те... · (Маг)
Автор: Darkensand
Последнее сообщение в 18:31

Контакты Контакты Copyright WoW-Info — World of Warcraft портал © 2026 | Условия и правила использования ресурса | Реклама / Услуги
WoW-Info портал.World of Warcraft портал — готовые сервера, сайты, картинки, аддоны, патчи, читы, баги, mangos, ArcEmu, TrinityCore, Warcraft 3, новости, Cataclysm...
Яндекс.Метрика Хостинг від uCoz