توظيح:يك مبدل قوى كه مى تونه بايت رو به كيلو بايت,مگابايت,ترابايت تبديل كنه
اينم كد:
<!--Best Codes By WwW.Javacode.loxblog.com\Please Dont Delete this Line-->
<form name="bandwidth">
<p><input type="text" name="original" size="20" value=1024> <select size="1" name="units">
<option value="Bytes">بايت</option>
<option value="Kb">كيلو بايت</option>
<option value="Mb">مگا بايت</option>
<option value="Gb">گيگا بايت</option>
</select> <input type="button" value="محاسبه" name="B1" onClick="calculate()"></p>
</form>
<p>
<script>
var bytevalue=0
function calculate(){
var invalue=document.bandwidth.original.value
var selectunit=document.bandwidth.units.options[document.bandwidth.units.selectedIndex].value
if (selectunit=="Bytes")
bytevalue=invalue
else if (selectunit=="كيلو بايت")
bytevalue=invalue*1024
else if (selectunit=="مگابايت")
bytevalue=invalue*1024*1024
else if (selectunit=="گيگابايت")
bytevalue=invalue*1024*1024*1024
alert (invalue+" "+selectunit+" is equal to:\n\n- "+bytevalue+" Bytes\n- "+Math.round(bytevalue/1024)+" Kb\n- "+Math.round(bytevalue/1024/1024)+" Mb\n- "+Math.round(bytevalue/1024/1024/1024)+" Gb\n")
}
</script>
<!--Best Codes By WwW.Javacode.loxblog.com\Please Dont Delete this Line-->
نظرات شما عزیزان:
.: Weblog Themes By Pichak :.