电脑技术学习

黑色星期五搜索器

dn001

<!-- 第一步:把如下代码加入<body>区域中 -->
<style>

#InternalDiv {position:relative;width:250px;height:1px;color:blue;background-color:#FDF5E6;border-style:double;border-color:blue;padding-top:5px;padding-left:5px;padding-right:5px;padding-bottom:5px;margin:3px;visibility:visible;z-index:10;top:50;left:0;}

</style>

<script>

function startitup() {

var BasicHTML = "<center>这里是搜索结果显示区</center>"

document.all["InternalDiv"].innerHTML = BasicHTML;

}

</script>

<script>

var new_Date=new Date()

//var DOW=new_Date.getDay()+1

var DOM=new_Date.getDate()

//var Month=new_Date.getMonth()+1

var Year=new_Date.getFullYear()

var LongMonth = new Array("January","February","March","April","May","June","July","August","September","October","November","December")

var LongDay = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")

var setTimer = 5000;

function find13th() {

var Start = startyear.value

var End = endyear.value

var TooMuch = End-Start

//alert(TooMuch)

if (confirm("搜索过程也许需要些时间,请耐心等待..."))

if (End < Start);;;;;;//if end<start alert user, else

alert("对不起,起始日期应该比结束日期大")

else {;//allow dates and continue

var BasicHTML = "<center><u>搜索结果</u>"

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

}

}

else {

var TestDate = new Date(YearTest,MonthSelect.value,13)

if (TestDate.getDay()==5)

BasicHTML = BasicHTML+"<br>"+LongMonth[MonthSelect.value]+" "+TestDate.getDate()+", "+YearTest

}

}

document.all["InternalDiv"].innerHTML = BasicHTML;;

}

else {

alert("Please make the years closer together..")

}

}

function clearResults() {

var BasicHTML = "<center>这里是结果显示区</center>"

document.all["InternalDiv"].innerHTML = BasicHTML;

}

</script>
输入开始年份:
<input type="Text" size="5" maxlength="4" name="startyear" value="2002">
<br><br>
输入结束年份:
<input type="Text" size="5" maxlength="4" name="endyear" value="2002">
<br><br>
请选择具体月份:
<select NAME="MonthSelect" size="1" style="HEIGHT: 22px; WIDTH: 130px">
<option VALUE ="20" SELECTED>所有月份</option>
<option value="0">January</option>
<option value="1">February</option>
<option value="2">March</option>
<option value="3">April</option>
<option value="4">May</option>
<option value="5">June</option>
<option value="6">July</option>
<option value="7">August</option>
<option value="8">September</option>
<option value="9">October</option>
<option value="10">November</option>
<option value="11">December</option>
</select><br><br>
<input type="Button" value="搜索结果" onmouseup="find13th()">
<input type="Button" value="清除结果" onmouseup="clearResults()">
<layer id="Layer1"><div id="InternalDiv"></div></layer>
<!-- 第二步:把如下代码加入<body>区域中 -->
<BODY onLoad="startitup()">