
<head>
..
<script Language="Javascript">
<!-- °¨Ãã
function getweek(){
mydate=now;
mydate.setYear(self.formname.yy.value);
mydate.setMonth(self.formname.mm.value-1);
mydate.setDate(self.formname.dd.value);
weeks='ÀÏ¿ùȼö¸ñ±ÝÅä';
self.formname.result.value=mydate.getYear()+'³â '+(mydate.getMonth()+1)+'¿ù '+
mydate.getDate()+'ÀÏÀº '+weeks.substring(mydate.getDay(),mydate.getDay()+1)+'¿äÀÏ';
}
// °¨Ãã ³¡ -->
</script>
</head>
<body>
..
<table border=0 class=brown>
<colgroup><col style="width:40%;"><col><colgroup>
<script Language="Javascript">
<!-- °¨Ãã
now=new Date();
document.write('<tr><td>now</td><td>= ',now,'</td></tr>')
document.write('<tr><td>now.getDate()</td><td>= ',now.getDate(),'</td></tr>')
document.write('<tr><td>now.getHours()</td><td>= ',now.getHours(),'</td></tr>')
document.write('<tr><td>now.toGMTString()</td><td>= ',now.toGMTString(),'</td></tr>')
document.write('<tr><td>now.toLocaleString()</td><td>= ',now.toLocaleString(),'</td></tr>')
document.write('<tr><td>now.getDate()</td><td>= ',now.getDate(),'</td></tr>')
document.write('<tr><td>now.getDay()</td><td>= ',now.getDay(),'</td></tr>')
document.write('<tr><td>now.getHours()</td><td>= ',now.getHours(),'</td></tr>')
document.write('<tr><td>now.getMinutes()</td><td>= ',now.getMinutes(),'</td></tr>')
document.write('<tr><td>now.getMonth()</td><td>= ',now.getMonth(),'</td></tr>')
document.write('<tr><td>now.getSeconds()</td><td>= ',now.getSeconds(),'</td></tr>')
document.write('<tr><td>now.getTime()</td><td>= ',now.getTime(),'</td></tr>')
document.write('<tr><td>now.getTimezoneOffset()</td><td>= ',
now.getTimezoneOffset(),'</td></tr>')
document.write('<tr><td>now.getYear()</td><td>= ',now.getYear(),'</td></tr>')
document.write('<tr><td><b>ÇöÀç ½Ã°¢</b> ')
document.write('<br>(window status¿¡µµ ³ªÅ¸³²)</td>')
timeValue=""+now.getYear()+"/"+(now.getMonth()+1)+"/"+now.getDate()+" "
hours=now.getHours();
ampm=((hours >12) ? "pm" : "am")
hours=((hours >12) ? hours -12 : hours)
timeValue +=((hours < 10) ? ":0" : ":")+hours
minutes=now.getMinutes();
timeValue +=((minutes < 10) ? ":0" : ":")+minutes
seconds=now.getSeconds();
timeValue +=((seconds < 10) ? ":0" : ":")+seconds
document.write('<td>= <font color=0000ff><b>',timeValue+
'</b></font><font color=ff0000> '+ampm.sup(),'</font></td></tr>')
window.status=timeValue+" "+ampm
document.write("<tr><td>ÆäÀÌÁö ÃÖÁ¾ ¼öÁ¤ document.lastModified</td>")
document.write('<td>= <font color=409040><b>',document.lastModified,'</b></font></td></tr>')
// °¨Ãã ³¡ -->
</script>
<form name="formname" type="post">
<tr><td>
<input type="text" name="yy" size="4" value="2000"> ³â
<input type="text" name="mm" size="2" value="01"> ¿ù
<input type="text" name="dd" size="2" value="01"> ÀÏÀº</td><td>
<input type="button" value="È®ÀÎ" onclick="getweek()">
<input type="text" name="result" size="22" value="">
</td></tr>
</form>
</table></div>
..
</body>
Áß¿ä »çÇ×
- stringÀÇ °áÇÕ +
- Á¶°Ç °Ë»ö ampm=((hours >12) ? "pm" : "am"À¸·Î Á¶°Ç¿¡ ¸ÂÀ¸¸é pm, Ʋ¸®¸é am
- JavascriptÀÇ document.write()¾È¿¡¼ ÁÙ¹Ù²Þ ÇÒ ¶§´Â ÀûÁ¤ÇÑ À§Ä¡¿¡¼ ÇÏ¿©¾ß ÇÑ´Ù. ±×·¸Áö ¾ÊÀ¸¸é stringÀÌ ³Ê¹« ±æ¾îÁ®¼ ¿À·ù°¡ ¹ß»ýµÈ´Ù.
- ½ÃÀÛ '...' ÀÌÀü
- Äĸ¶(,) ÀÌÀüÀ̳ª ÀÌÈÄ
- stringÀÌ ³Ê¹« ±æ¸é '...'+'...'·Î ȤÀº '...', '...'·Î Àß¶ó ÁÙ¸¶²Þ
- string °áÇÕÀ» À§ÇÑ+ÀÌÀüÀ̳ª ÀÌÈÄ
|