Link to home
Start Free TrialLog in
Avatar of Joana
Joana

asked on

Month Picker

How would i wirte a calendar that looks just like a normal date picker calander but instead of days you pick the month.  So i have teh year at the top (which u can scroll) and the months undernether and you pick teh month and it returns it to the text box
Avatar of Lord_McFly
Lord_McFly

I quickly whipped up a month picker - I didn't include the year selection because there is 12 months in every year.

So heres my effort...

TheForm.htm ==================================================================================================================
<html>
<head>
<title>The Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">

<form name="Month" method="post" action="TheForm.htm">
      <input type="text" name="f_0" value="" maxlength="2" size="3">
      [<a href="javascript: void(0)" onClick="window.open('Month.htm','Month','width=250,height=105'); return false">Month</a>]
</form>
</body>
</html>
===========================================================================================================================

Month.htm ====================================================================================================================
<html>
<head>
<title>Month</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function PostBack(Month)
      {
            window.opener.document.Month.f_0.value=Month;
            window.close()
      }
//-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="5" topmargin="5">
<table width="240" cellspacing="0" cellpadding="1" border="1">
      <tr>
            <td colspan="4" align="center">Select Month</td>
      </tr>
      <tr>
            <td width="40" height="20" align="center"><a href="javascript:void(0)" onClick="PostBack(1)">1</a></td>
            <td width="40" align="center"><a href="javascript:void(0)" onClick="PostBack(2)">2</a></td>
            <td width="40" align="center"><a href="javascript:void(0)" onClick="PostBack(3)">3</a></td>
            <td width="40" height="20" align="center"><a href="javascript:void(0)" onClick="PostBack(4)">4</a></td>
      </tr>
      <tr>
            <td width="40" align="center"><a href="javascript:void(0)" onClick="PostBack(5)">5</a></td>
            <td width="40" align="center"><a href="javascript:void(0)" onClick="PostBack(6)">6</a></td>
            <td width="40" height="20" align="center"><a href="javascript:void(0)" onClick="PostBack(7)">7</a></td>
            <td width="40" align="center"><a href="javascript:void(0)" onClick="PostBack(8)">8</a></td>
      </tr>
      <tr>
            <td width="40" align="center"><a href="javascript:void(0)" onClick="PostBack(9)">9</a></td>
            <td width="40" height="20" align="center"><a href="javascript:void(0)" onClick="PostBack(10)">10</a></td>
            <td width="40" align="center"><a href="javascript:void(0)" onClick="PostBack(11)">11</a></td>
            <td width="40" align="center"><a href="javascript:void(0)" onClick="PostBack(12)">12</a></td>
      </tr>
</table>
</body>
</html>
===========================================================================================================================
Avatar of Joana

ASKER

hiya
that is almost exactly what i want but i still need the textbox at teh top that scrolls years as teh user has to select year and month
Is the year passed back to the main form?
Avatar of Joana

ASKER

yip so the text box would have 4/2004 :-)
ASKER CERTIFIED SOLUTION
Avatar of Lord_McFly
Lord_McFly

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Joana

ASKER

Perfect :-)