본 예제의 자바스크립트입니다.
<html> <head> <title>http://www.happycgi.com</title> </HEAD>
<BODY>
<script> <!-- var new_Date=new Date() var DOM=new_Date.getDate() var Year=new_Date.getFullYear() var LongMonth = new Array("01월","02월","03월","04월","05월","06월","07월","08월","09월","10월","11월","12월") var LongDay = new Array("일","월","화","수","목","금","토") var setTimer = 5000;
function find13th() { var Start = startyear.value var End = endyear.value var TooMuch = End-Start if (confirm("Caution, this may result in an extremely large result, and may take a long time to display those results.")) if (End < Start) //if end<start alert user, else alert("Sorry, the ending year must be greater than or equal to the beginning year..") else { //allow dates and continue var BasicHTML = "<B>검색결과!!</B>" for (YearTest=Start;YearTest<=End;YearTest++) { if (MonthSelect.value==20) { for (MonthTest=0;MonthTest<=11;MonthTest++) { var TestDate = new Date(YearTest,MonthTest,13) if (TestDate.getDay()==5) // BasicHTML = BasicHTML+"<br>"+LongMonth[MonthTest]+" "+TestDate.getDate()+", "+YearTest BasicHTML = BasicHTML+"<br>"+YearTest+"년, "+LongMonth[MonthTest]+" "+TestDate.getDate()+"일" } } else { var TestDate = new Date(YearTest,MonthSelect.value,13) if (TestDate.getDay()==5) BasicHTML = BasicHTML+"<br>"+YearTest+"년, "+LongMonth[MonthSelect.value]+" "+TestDate.getDate()+"일" } } document.all["InternalDiv"].innerHTML = BasicHTML; } else { alert("Please make the years closer together..") } }
function clearResults() { var BasicHTML = "<B>검색결과!!</B>" document.all["InternalDiv"].innerHTML = BasicHTML; } //--> </script>
<B>검색기간 :</B><br> <B>시작년도 :</B> <input type="Text" size="5" maxlength="4" name="startyear" value="2005"> ~ <B>마지막년도 : </b> <input type="Text" size="5" maxlength="4" name="endyear" value="2010">
<select NAME="MonthSelect" size="1"> <option VALUE ="20" SELECTED>특정 월(月)을 지정</option> <option value="0">1월</option> <option value="1">2월</option> <option value="2">3월</option> <option value="3">4월</option> <option value="4">5월</option> <option value="5">6월</option> <option value="6">7월</option> <option value="7">8월</option> <option value="8">9월</option> <option value="9">10월</option> <option value="10">11월</option> <option value="11">12월</option> </select>
<br><br> <input type="Button" value="검색" onmouseup="find13th()"><input type="Button" value="RESET" onmouseup="clearResults()">
<p> <table cellpadding=8 bgcolor=999999 cellspacing=1 width=180> <td bgcolor=white><layer id="Layer1"><div id="InternalDiv"></div></layer></td> </table>
|