자바스크립트 바이오 리듬
본문
<html><head><title>바이오리듬</title>
<script>
function ck(form) {
var a=new Date();
var b_year;
var b_month;
var b_day;
var t_year;
var t_month;
var t_day;
if (!form.by.value) {
b_year = 1977;
b_month = 1;
b_day = 14;
}
else {
b_year=form.by.value;
b_month=form.bm.value;
b_day=form.bd.value;
}
if (!form.by.value) {
t_year = a.getYear();
t_month = a.getMonth();
t_day = a.getDate();
}
else {
t_year=form.by.value;
t_month=form.bm.value;
t_day=form.bd.value;
}
var b_hour = 1;
var b_min = 1;
var b_sec = 1;
var total=a.getTime();
total/=60*60*24;
var myt = new Date(b_year,b_month,b_day,b_hour,b_min,b_sec);
myt = myt.toGMTString();
var my_total=Date.parse(myt);
my_total/=60*60*24;
var totalday = total - my_total;
var pis = 3.141592654;
var physical = Math.sin((totalday / 23) * 2 * pis) * 100;
var emotional = Math.sin((totalday / 28) * 2 * pis) * 100;
var mental = Math.sin((totalday / 33) * 2 * pis) * 100;
var intuitive = Math.sin((totalday / 38) * 2 * pis) * 100;
physical = parseInt(physical);
emotional = parseInt(emotional);
mental = parseInt(mental);
intuitive = parseInt(intuitive);
document.write('자바스크립트 바이오리듬<table><tr>');
width=physical;
if (width<0) {
width=-physical;
document.write('<td><hr size=2 color=blue align=right width='+width+'></td><td width=100> 체력 : '+physical+'</td><td></td></tr>');
}
else {
width=physical;
document.write('<td></td><td> 체력 : '+physical+'</td><td><hr size=2 color=red align=left width='+width+'></td></tr>');
}
width=emotional;
if (width<0) {
width=-emotional;
document.write('<td><hr size=2 color=blue align=right width='+width+'></td><td> 감성 : '+emotional+'</td><td></td></tr>');
}
else {
width=emotional;
document.write('<td></td><td> 감성 : '+emotional+'</td><td><hr size=2 color=red align=left width='+width+'></td></tr>');
}
width=mental;
if (width<0) {
width=-mental;
document.write('<td><hr size=2 color=blue align=right width='+width+'></td><td> 지각 : '+mental+'</td><td></td></tr>');
}
else {
width=mental;
document.write('<td></td><td> 지각 : '+mental+'</td><td><hr size=2 color=red align=left width='+width+'></td></tr>');
}
width=intuitive;
if (width<0) {
width=-intuitive;
document.write('<td><hr size=2 color=blue align=right width='+width+'></td><td> 지성 : '+intuitive+'</td><td></td></tr>');
}
else {
width=intuitive;
document.write('<td></td><td> 지성 : '+intuitive+'</td><td><hr size=2 color=red align=left width='+width+'></td></tr>');
}
document.write('</table>');
}
</script>
</head>
<body>
<form name=f><table><tr><td colspan=2>자바스크립트 바이오리듬</td></tr>
<tr><td>생년월일 (양력)</td><td><input type=input name=by size=4 value=1977>년
<input type=input name=bm size=2 value=1>월
<input type=input name=bd size=2 value=14>일</td></tr>
<tr><td>알아볼 날짜지정 </td><td>
<script>
var z=new Date();
var t_year = z.getYear();
var t_month = z.getMonth();
var t_day = z.getDate();
var total=z.getTime();
document.write('<input type=input name=ty size=4 value='+t_year +'>년');
document.write(' <input type=input name=tm size=2 value='+t_month+'>월');
document.write(' <input type=input name=td size=2 value='+t_day+'>일');
</script>
<input type=button value=보기 onClick="ck(this.form)"></td></tr></table>
</form>
</body>
</html>
출처 : http://www.aircon1004.com/data/bbs/board.php?bo_table=pds1&wr_id=158
<script>
function ck(form) {
var a=new Date();
var b_year;
var b_month;
var b_day;
var t_year;
var t_month;
var t_day;
if (!form.by.value) {
b_year = 1977;
b_month = 1;
b_day = 14;
}
else {
b_year=form.by.value;
b_month=form.bm.value;
b_day=form.bd.value;
}
if (!form.by.value) {
t_year = a.getYear();
t_month = a.getMonth();
t_day = a.getDate();
}
else {
t_year=form.by.value;
t_month=form.bm.value;
t_day=form.bd.value;
}
var b_hour = 1;
var b_min = 1;
var b_sec = 1;
var total=a.getTime();
total/=60*60*24;
var myt = new Date(b_year,b_month,b_day,b_hour,b_min,b_sec);
myt = myt.toGMTString();
var my_total=Date.parse(myt);
my_total/=60*60*24;
var totalday = total - my_total;
var pis = 3.141592654;
var physical = Math.sin((totalday / 23) * 2 * pis) * 100;
var emotional = Math.sin((totalday / 28) * 2 * pis) * 100;
var mental = Math.sin((totalday / 33) * 2 * pis) * 100;
var intuitive = Math.sin((totalday / 38) * 2 * pis) * 100;
physical = parseInt(physical);
emotional = parseInt(emotional);
mental = parseInt(mental);
intuitive = parseInt(intuitive);
document.write('자바스크립트 바이오리듬<table><tr>');
width=physical;
if (width<0) {
width=-physical;
document.write('<td><hr size=2 color=blue align=right width='+width+'></td><td width=100> 체력 : '+physical+'</td><td></td></tr>');
}
else {
width=physical;
document.write('<td></td><td> 체력 : '+physical+'</td><td><hr size=2 color=red align=left width='+width+'></td></tr>');
}
width=emotional;
if (width<0) {
width=-emotional;
document.write('<td><hr size=2 color=blue align=right width='+width+'></td><td> 감성 : '+emotional+'</td><td></td></tr>');
}
else {
width=emotional;
document.write('<td></td><td> 감성 : '+emotional+'</td><td><hr size=2 color=red align=left width='+width+'></td></tr>');
}
width=mental;
if (width<0) {
width=-mental;
document.write('<td><hr size=2 color=blue align=right width='+width+'></td><td> 지각 : '+mental+'</td><td></td></tr>');
}
else {
width=mental;
document.write('<td></td><td> 지각 : '+mental+'</td><td><hr size=2 color=red align=left width='+width+'></td></tr>');
}
width=intuitive;
if (width<0) {
width=-intuitive;
document.write('<td><hr size=2 color=blue align=right width='+width+'></td><td> 지성 : '+intuitive+'</td><td></td></tr>');
}
else {
width=intuitive;
document.write('<td></td><td> 지성 : '+intuitive+'</td><td><hr size=2 color=red align=left width='+width+'></td></tr>');
}
document.write('</table>');
}
</script>
</head>
<body>
<form name=f><table><tr><td colspan=2>자바스크립트 바이오리듬</td></tr>
<tr><td>생년월일 (양력)</td><td><input type=input name=by size=4 value=1977>년
<input type=input name=bm size=2 value=1>월
<input type=input name=bd size=2 value=14>일</td></tr>
<tr><td>알아볼 날짜지정 </td><td>
<script>
var z=new Date();
var t_year = z.getYear();
var t_month = z.getMonth();
var t_day = z.getDate();
var total=z.getTime();
document.write('<input type=input name=ty size=4 value='+t_year +'>년');
document.write(' <input type=input name=tm size=2 value='+t_month+'>월');
document.write(' <input type=input name=td size=2 value='+t_day+'>일');
</script>
<input type=button value=보기 onClick="ck(this.form)"></td></tr></table>
</form>
</body>
</html>
출처 : http://www.aircon1004.com/data/bbs/board.php?bo_table=pds1&wr_id=158
관련링크
댓글목록
등록된 댓글이 없습니다.