시작페이지로 즐겨찾기추가
로그인
회원가입 l 출석체크 l 마이페이지 l CGIMALL
happycgi
자료실 사이트등록 랭킹100 프로그램리뷰 관리자추천자료 초보가이드
커뮤니티
전체 펼쳐보기
퀵메뉴링크 jquery , CSS , PHP , Javascript , 무료폰트 , ASP
상세검색
 > JAVASCRIPT > javascript 소스창고 > 계산기 > 길이단위계산기 상세정보
사이트등록
클라우드태그
Javascript
PHP
CSS
ASP
HTML
mysql
jquery
API
image
Mobile
slide
게시판
메뉴
현재접속자 109 새로고침
길이단위계산기
소스통계정보 오류신고 및 문의
해피팀
네티즌
트위터로 보내기 페이스북으로 보내기 네이버로공유
소스분류 계산기
다운로드 횟수 959 회
간단설명 센티미터,미터,킬로미터,마일등의 길이와 거리에 관련된 단위만을 자동으로 계산해주는 자바스크립트입니다.
평가하기 훌륭함 매우좋음 좋음 괜찮음 보통 별로
소스다운로드 데모 미리보기 스크랩하기

길이에 의한, 길이만을 위한, 길이의 계산자바스크립트!!

다체로운 길이 및 거리단위를 간단하게 계산할수 있는 계산식 자바스크립트입니다.

아래는 자바스크립트의 원문입니다.

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">

var factors1 = new Array(1, 0.01, 0.00001, 0.00000621, 0.3937, 0.0328, 0.01094);
var factors2 = new Array(100, 1, 0.001, 0.000621, 39.37, 3.28, 1.094);
var factors3 = new Array(100000, 1000, 1, 0.621, 39370, 3280, 1094);
var factors4 = new Array(160934, 1609.34, 1.60934, 1, 63360, 5280,1760);
var factors5 = new Array(2.54, 0.0254, 0.0000254, 0.0000158, 1, 0.08333, 0.02778);
var factors6 = new Array(30.48, 0.3048, 0.0003048, 0.0001896, 12, 1, 0.3333);
var factors7 = new Array(91.44, 0.9144, 0.0009144, 0.0005688, 36, 3, 1);
var factors = new Array(factors1,factors2,factors3,factors4,factors5,factors6,factors7);

function convert_unit()
{
from_index = document.length_con.from_unit.selectedIndex;
to_index = document.length_con.to_unit.selectedIndex;
factor = factors[from_index][to_index];
document.getElementById("formula").innerHTML = document.length_con.from_unit.options[document.length_con.from_unit.selectedIndex].text + " = " + factor + " " + document.length_con.to_unit.options[document.length_con.to_unit.selectedIndex].text;
if(isNaN(document.length_con.from_value.value))
document.getElementById("to_value").innerHTML = "Not a valid number.";
else
document.getElementById("to_value").innerHTML = factor * document.length_con.from_value.value;
}
</script>

 

</head>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<form name="length_con">

<table>

<tr>
<td>From </td>

<td>
<select name=from_unit onChange="convert_unit()";>
<option> 센티미터</option>
<option> 미터</option>
<option> 킬로미터</option>
<option> 마일</option>
<option> 인치</option>
<option> 피트</option>
<option> 야드</option>
</select>

</td>
<td> To </td>
<td>
<select name=to_unit onChange="convert_unit()";>
<option> 센티미터</option>
<option> 미터</option>
<option> 킬로미터</option>
<option> 마일</option>
<option> 인치</option>
<option> 피트</option>
<option> 야드</option>
</select>

</td>
</tr>
<tr>
<td> </td><td colspan="3"><div id="formula">센티미터 = 1 센티미터</div></td>
</tr>

<tr>
<td colspan="4"> </td>
</tr>

<tr>
<td>Enter </td>
<td><input type="text" name="from_value" value="1" size="12" maxlength="12"></td>
<td> <input type=button value="=" onClick="convert_unit()";> </td>
<td><div id="to_value">1</div></td>
</tr>

</table>

</form>

</body>

</html>


네티즌 의견   이용하신 자료의 후기를 자유롭게 작성하세요. (상업적인 광고 및 도배성 글 등은 사전통보없이 삭제될 수 있습니다.)
내용 아이디 의견남기기
등록된 의견이 없습니다.
1
이름
내용
:네맞아요: :화나는군요: :잠와: :우울해: :이건아냐: :왕하하: 왕웃음~ 놀램~
평가하기 훌륭함 매우좋음 좋음 괜찮음 보통 별로
도배방지키
 30442472 보이는 도배방지키를 입력하세요.