Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Month picker (JAN-2008)

    Hi to aLL

    CAN ANY BODY HELP ME OUT IN WRITING JAVASCRIPT CODE FOR MONTH PICKER
    HERE I DONT NEED DATE, I JUST WANT ALL THE MONTHS IN PLACE OF DATES AND AN OPTION FOR SELECTING YEARS, WHEN I SELECT MONTH AND CHOOSE YEAR, THEN TEXT FIELD GET JAN-2008
    clearly, need a calender with out date in it, months and years....
    colud you please give me any information regarding this

    thank you
    Last edited by santhosh.v25; 09-08-2008 at 02:02 PM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,159
    Thanks
    203
    Thanked 2,548 Times in 2,526 Posts
    PLEASE DO NOT SHOUT!

    Try this:-
    Code:
    <form name = "myform">
    <select name = "mths" id = "mths" onchange = "chkDate()">
    <option value ="x">Select a month
    <option value ="Jan">January
    <option value ="Feb">February
    <option value ="Mar">March
    <option value ="Apr">April
    <option value ="May">May
    <option value ="Jun">June
    <option value ="Jul">July
    <option value ="Aug">August
    <option value ="Sep">September
    <option value ="Oct">October
    <option value ="Nov">November
    <option value ="Dec">December
    </select>
    
    <select name = "year" id = "year" onchange = "chkDate()">
    <option value = "x">Select a year
    <option value = "2007">2007
    <option value = "2008">2008
    <option value = "2009">2009
    <option value = "2010">2010
    </select>
    
    <input type = "text" name = "dateBox" id = "dateBox" size = "12">
    </form>
    
    <script type = "text/javascript">
    function chkDate() {
    var mth = document.getElementById("mths").value;
    yr = document.getElementById("year").value;
    if (mth == "x") {
    alert ("Please select a month");
    return false;
    }
    
    if (yr == "x"){
    alert ("Please select a year");
    return false;
    }
    var theDate = mth + "-" + yr;
    document.myform.dateBox.value = theDate;
    }
    </script>

    Quizmaster: In mythology, what term for a potion that increases sexual desire is derived from the name of the Greek goddess of love?
    Contestant: Viagra

  • #3
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanx alot sending a solution for month picker,
    actually i need a solution like calender when we hit calender a popup will come and we select some date month and year, like this cant we select just month and year and No date should be visible, could you help me in doing this

    thank you very much

  • #4
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Here's a monthpicker I wrote

    Here's a JS monthpicker I wrote, hope it helps:

    Code:
    <HTML>
    <HEAD>
    	<TITLE>Calendar Popup To Select Date</TITLE>
    
    <style>
    .dbox {width:156px;
    	height:75px;
    	background-color:white;
    	display:none;
    	border:1px solid #808080;
    	}
    .dbox TABLE {
    	font-family: tahoma,verdana,arial;
    	font-size: 11px;
        }
    .dbox A {
    	padding: 3px 0;
    	color:black;
    	}
    .monthx {
    	text-decoration:none;
    	}
    .monthx:hover {
    	background-color:#FFB3BE;
    	border:1px solid #FF0000;
    	padding-left:3px;
    	padding-right:3px;
    	}
    .yearx {
    	padding: 3px 0;
        text-align: center;
        font-weight:bold;
    	}
    TABLE.data TD {
    	text-align:center;
    	border-bottom:1px solid #AAA;
    	background-color:#808080;
    	color:white;
    	}
    TABLE.data2 TD {
    	padding-top:3px;
    	text-align:center;
    	line-height:16px;
    	}
    </style>
    
    <script type="text/javascript">
    <!--
    var d = new Date();
    
    function upyear(di,dr) {
    	yea=parseInt(document.getElementById('year'+di).innerHTML)
    	yea=yea+dr
    	document.getElementById('year'+di).innerHTML=yea
    	return false
    }
    function gDate(di,mr) {
    	yea=parseInt(document.getElementById('year'+di).innerHTML)
    	zb=''
    	if (mr<10) zb='0'
    	eval('document.ndata.date'+di+'.value=zb+mr+"/"+yea')
    	document.getElementById("dbox"+di).style.display="none";
    	return false
    }
    //-->
    </script>
    
    </HEAD>
    <BODY>
    
    <FORM NAME="ndata">
    
    <INPUT TYPE="text" NAME="date1" VALUE="" SIZE=22> <A href='' onclick='document.ndata.date1.value="";document.getElementById("year1").innerHTML=d.getFullYear();document.getElementById("dbox1").style.display="block";return false' onFocus=this.blur()>select</A>
    
    <DIV ID="dbox1" class=dbox onBlur="this.style.display='none'">
    	<table cellpadding=0 cellspacing=0 width=100% height=15 border=0 class="data">
    	<TR>
    		<TD width=28><A href='' onClick='return upyear(1,-1)' onFocus=this.blur() class=monthx style="color:white"><B><</B></A></TD>
    		<TD><div id="year1" class=yearx></div></TD>
    		<TD width=28><A href='' onClick='return upyear(1,+1)' onFocus=this.blur() class=monthx style="color:white"><B>></B></A></TD>
    	</TR>
    	<TABLE>
    	<table cellpadding=0 cellspacing=0 width=100% height=45 border=0 class="data2">
    	<TR>
    		<TD height=15 width=39>
    		<A HREF='' onClick='return gDate(1,1)' onFocus=this.blur() class=monthx>Gen</A><BR>
    		<A HREF='' onClick='return gDate(1,5)' onFocus=this.blur() class=monthx>Mag</A><BR>
    		<A HREF='' onClick='return gDate(1,9)' onFocus=this.blur() class=monthx>Set</A></TD>
    		<TD height=15 width=39>
    		<A HREF='' onClick='return gDate(1,2)' onFocus=this.blur() class=monthx>Feb</A><BR>
    		<A HREF='' onClick='return gDate(1,6)' onFocus=this.blur() class=monthx>Giu</A><BR>
    		<A HREF='' onClick='return gDate(1,10)' onFocus=this.blur() class=monthx>Ott</A></TD>
    		<TD height=15 width=39>
    		<A HREF='' onClick='return gDate(1,3)' onFocus=this.blur() class=monthx>Mar</A><BR>
    		<A HREF='' onClick='return gDate(1,7)' onFocus=this.blur() class=monthx>Lug</A><BR>
    		<A HREF='' onClick='return gDate(1,11)' onFocus=this.blur() class=monthx>Nov</A></TD>
    		<TD height=15 width=39>
    		<A HREF='' onClick='return gDate(1,4)' onFocus=this.blur() class=monthx>Apr</A><BR>
    		<A HREF='' onClick='return gDate(1,8)' onFocus=this.blur() class=monthx>Ago</A><BR>
    		<A HREF='' onClick='return gDate(1,12)' onFocus=this.blur() class=monthx>Dic</A></TD>
    
    	</TR>
    	<TABLE></DIV>
    
    </FORM>
    </BODY>
    </HTML>


  •  

    LinkBacks (?)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •