<div class="de_term">
<img src="http://nmenu.mt.co.kr/common/button/btn_1week.gif" onclick="dateSub(7);" alt="1주일" />
<a href="#"><img src="http://nmenu.mt.co.kr/common/button/btn_15days.gif" onclick="dateSub(15);" alt="15일" /></a>
<a href="#"><img src="http://nmenu.mt.co.kr/common/button/btn_1month.gif" onclick="dateSub(30);" alt="1개월" /></a>
  <input type="text" onclick="inputDate(this);" id="text1" name="text1"/>
<!-- <button type="button" class="calendar" onclick="inputDate(this);"><span>달력</span></button> -->
  ~    <input type="text" onclick="inputDate(this);" id="text2"/>
<!-- <button type="button" class="calendar" onclick="inputDate(this);"><span>달력</span></button> -->
<button type="button" class="view" onclick="submitDate();">  <span>조회</span></button>
</div>
<SCRIPT LANGUAGE="JavaScript">
<!--
function dateSub(day){
var d = new Date();
var dt = d - day*24*60*60*1000;
var nd = new Date(dt);
// alert(nd);
// alert(String(nd.getYear()));
// alert(nd.getMonth()+1);
// alert(nd.getDate());
tempMonth = (String(nd.getMonth()+1));
tempDate = (String(nd.getDate()));
if (nd.getMonth()+1 < 10)
{
var tempMonth = "";
var tempMonth = "0"+String(nd.getMonth()+1)
}
if (nd.getDate() < 10)
{
var tempDate = "";
var tempDate = "0"+String(nd.getDate())
}
var temp = String(nd.getYear()) + tempMonth + tempDate;
// alert(temp);
document.getElementById("text1").value = temp;
var d1 = new Date();
var nd1 = new Date(d1);
tempMonth1 = (String(nd1.getMonth()+1));
tempDate1 = (String(nd1.getDate()));
if (nd1.getMonth()+1 < 10)
{
var tempMonth1 = "";
tempMonth1 = "0"+String(nd1.getMonth()+1)
}
if (nd1.getDate() < 10)
{
var tempDate1 = "";
tempDate1 = "0"+String(nd1.getDate())
}
var temp1 = String(nd1.getYear()) + tempMonth1 + tempDate1;
document.getElementById("text2").value = temp1;
}
function submitDate()
{
var i = document.f.text1.value;
var j = document.f.text2.value;
if (document.f.text1.value == "" || document.f.text2.value == ""){
alert("날짜를 입력하여 주세요.");
return;
}else{
document.f.action = "give.php?text1="+i+"&text2="+j;
document.f.submit();
}
}
//-->
</SCRIPT>
'개발도구 > PHP,ASP,JSP,SCRIPT' 카테고리의 다른 글
[파싱 xml- 주로 사용중] SimpleXMLElement Object (0) | 2011.10.20 |
---|---|
[javascript] date() 포멧 형식 (0) | 2011.10.20 |
[JAVA] charAt, substring, indexOf, length (0) | 2011.10.13 |
[rss feed] vimeo rss feed (0) | 2011.10.11 |
[php] select while 1,2 차열 배열형식 (0) | 2011.10.10 |