• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 23 رای - 2.83 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: کدها و اسکریپت سایت ها
حالت خطی
#5
س !!!!!!!!!!!! چند کد جاوااسکریپ دیگه !!!!!!!!!!!!!

با کد زیر می توانید یک تکست باکس قرار دهید که توسط دو دکمه مقدار آن کم و زیاد می شود.
کد:
<!-- ONE STEP TO INSTALL UP & DOWN BOX:

  1.  Copy the coding into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the BODY of your HTML document  -->

<BODY>

<center>
<form>
<input type=text name=amount value=5>
<input type=button value="up" onClick="javascript:this.form.amount.value++;">
<input type=button value="down" onClick="javascript:this.form.amount.value--;">
</form>
</center>


<!-- Script Size:  0.45 KB -->
در کد زیر می توانید با وارد کردن RGB مورد نظر، Hex آن را رنگ را نیز بدست آورید.
کد:
<!-- TWO STEPS TO INSTALL HEX-RGB CONVERTER:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<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>


<!-- Script Size:  3.91 KB -->
با کد زیر می توانید KB را به MB تبدیل کنید.
کد:
<!-- TWO STEPS TO INSTALL KB TO MB:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Gerald Schafer -->
<!-- Web Site:  http://www.robandger.com -->

<! >
<! >

<!-- Begin
function convert() {
if(document.KBtoMB.KB.value) {
document.KBtoMB.MB.value = eval(document.KBtoMB.KB.value / 1024);
}
else {
if(document.KBtoMB.MB.value) {
document.KBtoMB.KB.value = eval(document.KBtoMB.MB.value * 1024);
      }
   }
}
//  End -->
</script>

</HEAD>

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

<BODY>

<center>
<form name="KBtoMB">
<input type=text name="KB" size="16">KB
<input type=button name="KBtoMBgo"  value=" < = > " onClick="convert()">
<input type=text name="MB" size="16">MB
<input type=reset value=" Clear ">
</form>
</center>

<!-- Script Size:  1.25 KB -->
سوالی نیست؟
:::::::::::::::::::::::::   دیگه میرم ...   :::::::::::::::::::::::::

 
پاسخ
  


پیام‌های این موضوع
کدها و اسکریپت سایت ها - توسط امیر - 07-13-2012، 06:41 PM
RE: کدها و اسکریپت سایت ها - توسط Thewolf - 07-13-2012، 07:37 PM
RE: کدها و اسکریپت سایت ها - توسط امیر - 07-14-2012، 09:36 AM
RE: کدها و اسکریپت سایت ها - توسط Thewolf - 07-14-2012، 12:09 PM
RE: کدها و اسکریپت سایت ها - توسط Thewolf - 07-15-2012، 02:32 AM
RE: کدها و اسکریپت سایت ها - توسط امیر - 07-15-2012، 08:40 AM
RE: کدها و اسکریپت سایت ها - توسط Thewolf - 07-17-2012، 04:01 PM
RE: کدها و اسکریپت سایت ها - توسط امیر - 07-18-2012، 08:15 AM

موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  طراحی سایت در سال ۲۰۱۸ forouzan99 0 2,035 02-18-2018، 01:18 PM
آخرین ارسال: forouzan99
  نقش شبکه های اجتماعی در طراحی سایت forouzan99 0 1,705 02-18-2018، 01:13 PM
آخرین ارسال: forouzan99
  طراحی سایت صرافی mohi72 0 1,674 02-15-2018، 01:03 PM
آخرین ارسال: mohi72
  قیمت طراحی سایت sanatech 0 1,647 02-04-2018، 02:41 PM
آخرین ارسال: sanatech
  طراحی وب سایت کشاورزی sitecode 0 1,738 01-26-2018، 10:02 PM
آخرین ارسال: sitecode
  نیازهای ضروری هر سایت mohi72 0 1,696 01-24-2018، 11:50 AM
آخرین ارسال: mohi72
  طراحی سایت حرفه ای mohi72 0 1,576 12-24-2017، 11:36 AM
آخرین ارسال: mohi72
  اولین قدم برای طراحی سایت حرفه ای mohi72 0 1,705 12-17-2017، 11:03 AM
آخرین ارسال: mohi72
  نقش طراحی سایت در کسب و کار mohi72 0 1,954 12-11-2017، 02:05 PM
آخرین ارسال: mohi72
  طراحی سایت شرکتی mohi72 0 1,705 11-21-2017، 01:05 PM
آخرین ارسال: mohi72

پرش به انجمن:


Browsing: 1 مهمان