JavaScript - Date Of Birth Drop-downs Into 1 Field
I have a date of birth drop down for 'Day', 'Month' and a text field for Year.
How can I get the select value of the drop down and year text field into a single text field, separated by '-'? The single text field would need to update if someone changed the drop down / year selections. Hope someone can help - I'm stumped! Similar TutorialsHi , I am using date of birth field in my application and i m taking date of birth in yyyy-mm-dd format. I need to calculate age by using this date of birth and should show alert if age is less than 5 years. help me.... Thanks in advance Code: <script type="text/javascript"> /*********************************************** * Drop Down Date select script- by JavaScriptKit.com * This notice MUST stay intact for use * Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more ***********************************************/ var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec']; function populatedropdown(dayfield, monthfield, yearfield){ var today=new Date() var dayfield=document.getElementById(dayfield) var monthfield=document.getElementById(monthfield) var yearfield=document.getElementById(yearfield) for (var i=0; i<31; i++) dayfield.options[i]=new Option(i, i+1) dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day for (var m=0; m<12; m++) monthfield.options[m]=new Option(monthtext[m], monthtext[m]) monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's month var thisyear=today.getFullYear() for (var y=0; y<20; y++){ yearfield.options[y]=new Option(thisyear, thisyear) thisyear+=1 } yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year } </script> This script when the year is selected chooses 2011-2030 but I want like 1900-2011 How do I fix this and then how would I make sure that it isn't blank and then sends this data to one field in my database called "dob" in form "0000-00-00".. thanks.. Hi All, My first question on this forum. I have a form where we are capturing the Members Children information. I want to insert age in years to a field within this table by calculating age from Date of Birth (DOB). DOB format is mm/dd/yyyy and is a datetime data type in SQL. The DOB is added by the member while registering their child. Is there an onchange script that I could use here. Is it possible to auto populate a field from an other field within the same form?? Does anyone have any code samples that I could use?? Any pointers will be greatly appreciated. Thanks Vinny Hi, Im trying to create a drop down menu using the following code JS Code: function showMenu(theMenu) { thisMenu = document.getElementById(theMenu); var str = theMenu; if (thisMenu.className == str.slice(4)+'_off') { thisMenu.className = str.slice(4)+'_on'; } else { thisMenu.className = str.slice(4)+'_off'; } } function hideMenu(theMenu) { thisMenu = document.getElementById(theMenu); var str = theMenu; if (thisMenu.className == str.slice(4)+'_on') { thisMenu.className = str.slice(4)+'_off'; } else { thisMenu.className = str.slice(4)+'_on'; } } CSS Code: #wrapper { width: 770px; margin:10px auto; border:none; text-align:left; position:relative; z-index:0; } #wrapper div.1_off { /* visibility:hidden; z-index:-1; */ width:100px; position:absolute; top:40px; left:10px; height:70px; width:200px; margin:0px; visibility:visible; z-index:1; } #wrapper div.2_off { visibility:hidden; z-index:-1; } #wrapper div.1_on { width:100px; position:absolute; top:40px; left:10px; height:70px; width:200px; margin:0px; visibility:visible; z-index:1; background-color:#000; } #wrapper div.2_on { width:100px; position:absolute; top:40px; left:110px; height:70px; width:200px; margin:0px; visibility:visible; z-index:1; background-color:#000; } with the anchors tags onmouseover/out containting the relevant JS functions: Code: <a href="" onmouseover="showMenu('menu1')">Hello</a></td><td name="dropdown"> <a href="" onmouseover="showMenu('menu2')">Goodbye</a> and these divs nested within the wrapper div: Code: <div id="menu1" class="1_off">Yes</div><div id="menu2" class="2_off">No</div> Unfortunately the JS does not seem to be changing class of the div attributes. Any help would be greatly appreciated. Thanks Sol i'm trying to make a form where if 2 particular options are chosen from 2 dropdown boxes, it puts a value in a text field. Its not working and i hope you can help so far i've got Code: if (document.profile_quote.thickness.selectedIndex == "3" && document.profile_quote.machine.selectedIndex == "1") document.profile_quote.cutspeed.value = "34444" I am using the following code to show / hide form elements within a div based upon the drop down choice. Does anyone know how this code can be amended to use multiple drop downs within one form? Code: <html> <head> <title>Show and Hide</title> <script> //********************************************* // Function that Shows an HTML element //********************************************* function showDiv(divID) { var div = document.getElementById(divID); div.style.display = ""; //display div } //********************************************* // Function that Hides an HTML element //********************************************* function hideDiv(divID) { var div = document.getElementById(divID); div.style.display = "none"; // hide } //***************************************************************************** // Function that Hides all the Div elements in the select menu Value //***************************************************************************** function hideAllDivs() { //Loop through the seclect menu values and hide all var selectMenu = document.getElementById("selectMenu"); for (var i=0; i<=selectMenu.options.length -1; i++) { hideDiv(selectMenu.options[i].value); } } //********************************************* // Main function that calls others to toggle divs //********************************************* function toggle(showID) { hideAllDivs(); // Hide all showDiv(showID); // Show the one we asked for } </script> </head> <body onload="hideAllDivs();"> <select id="selectMenu" onchange="toggle(this.options[this.options.selectedIndex].value)"> <option value="formNumber1"> Show Form 1 </option> <option value="formNumber2"> Show Form 2 </option> <option value="formNumber3"> Show Form 3 </option> <option value="formNumber4"> Show Form 4 </option> </select> <div id="formNumber1"> I am Form Number one. Any content within this div will be showed</div> <div id="formNumber2"> I am Form Number two. Any content within this div will be showed</div> <div id="formNumber3"> I am Form Number three. Any content within this div will be showed</div> <div id="formNumber4"> I am Form Number four. Any content within this div will be showed</div> </body> </html> Thanks in advance! Hi guys, it's a bit of a large question but I've been messing around with code for a while, and nothing seems to work... Basically, I need to make, a 'dynamic theme changer'. Basically what I need to do is have several drop down boxes, each one with some colours available as options. When you select one, it automatically (without refreshing the page) updates a certain element's style. For example, if you selected green as one colour and red as another, the element linked to the first drop-down would turn green, and the element linked to the second drop-down would turn red, and so on so forth. It then needs to have a 'save' button, which saves the settings, and adds a cookie with the style details so that when they visit the page again it's still personalized. There also needs to be a cancel button which discards all changes. I know it's a large question but I'm ripping my hair out over this one! =P Your help is much appreciated. Hi all, I think I have posted in the right place, if not appologies. Anyhow, I am currently creating a website for my canvas printing business and run into a few javascripting issues. I am trying to create a small navigation form whereby a customer can select from a dropdown the required width of canvas, this selection will then populate a second dropdown with a choice of canvas heights. Ok, so trawling many sites I came across some javascript that I was able to chop about and have this part sorted. The problem now is that I would like to include a submit button that when clicked takes the customer to a webpage based on their two dropdown choices, and being a complete newby when it comes to javascript I am stuck trying to include the script to enable this. eg: if they select '20" (51cm)' from the first dropdown and '16" (41cm)' from the second dropdown, they will navigate to "http: / / 20x16.co.uk" canvas print page. I have not currently created the canvas print pages so am unable to give the URLs of the pages. However if somebody can lend a hand to get me started and indicate where the desitnation URLs need to be added, I can drop these in later. The way that the script is currently written, the linked url could be based soley on the choice made in the second dropdown. I have a draft page with the working dropdowns he http://merchant.auctivacommerce.com/...iewtheme=32189 And the code that I currently have is: Code: <script type="text/javascript"> var SELECT_WIDTH_FIRST = []; var WIDTH08 = []; var WIDTH10 = []; var WIDTH12 = []; var WIDTH14 = []; var WIDTH16 = []; var WIDTH18 = []; var WIDTH20 = []; var WIDTH24 = []; var WIDTH30 = []; var WIDTH36 = []; var WIDTH42 = []; var WIDTH48 = []; var WIDTH60 = []; var WIDTH72 = []; SELECT_WIDTH_FIRST[0] = new Option("Please Select Width First", "SelWidFir"); WIDTH08[0] = new Option("8'' (20cm)", "0808"); WIDTH08[1] = new Option("10'' (25cm)", "0810"); WIDTH08[2] = new Option("12'' (30cm)", "0812"); WIDTH08[3] = new Option("14'' (35cm)", "0814"); WIDTH08[4] = new Option("16'' (41cm)", "8016"); WIDTH08[5] = new Option("18'' (46cm)", "0818"); WIDTH08[6] = new Option("20'' (51cm)", "0820"); WIDTH08[7] = new Option("24'' (61cm)", "0824"); WIDTH10[0] = new Option("8'' (20cm)", "1008"); WIDTH10[1] = new Option("10'' (25cm)", "1010"); WIDTH10[2] = new Option("12'' (30cm)", "1012"); WIDTH10[3] = new Option("14'' (35cm)", "1014"); WIDTH10[4] = new Option("16'' (41cm)", "1016"); WIDTH10[5] = new Option("18'' (45cm)", "1018"); WIDTH10[6] = new Option("20'' (51cm)", "1020"); WIDTH10[7] = new Option("24'' (61cm)", "1024"); WIDTH10[8] = new Option("30'' (76cm)", "1030"); WIDTH12[0] = new Option("8'' (20cm)", "1208"); WIDTH12[1] = new Option("10'' (25cm)", "1210"); WIDTH12[2] = new Option("12'' (30cm)", "1212"); WIDTH12[3] = new Option("14'' (35cm)", "1214"); WIDTH12[4] = new Option("16'' (41cm)", "1216"); WIDTH12[5] = new Option("18'' (45cm)", "1218"); WIDTH12[6] = new Option("20'' (51cm)", "1220"); WIDTH12[7] = new Option("24'' (61cm)", "1224"); WIDTH12[8] = new Option("30'' (76cm)", "1230"); WIDTH12[9] = new Option("36'' (91cm)", "1236"); WIDTH14[0] = new Option("8'' (20cm)", "1408"); WIDTH14[1] = new Option("10'' (25cm)", "1410"); WIDTH14[2] = new Option("12'' (30cm)", "1412"); WIDTH14[3] = new Option("14'' (35cm)", "1414"); WIDTH14[4] = new Option("16'' (41cm)", "1416"); WIDTH14[5] = new Option("18'' (45cm)", "1418"); WIDTH14[6] = new Option("20'' (51cm)", "1420"); WIDTH14[7] = new Option("24'' (61cm)", "1424"); WIDTH14[8] = new Option("30'' (76cm)", "1430"); WIDTH14[9] = new Option("36'' (91cm)", "1436"); WIDTH14[10] = new Option("42'' (107cm)", "1442"); WIDTH16[0] = new Option("8'' (20cm)", "1608"); WIDTH16[1] = new Option("10'' (25cm)", "1610"); WIDTH16[2] = new Option("12'' (30cm)", "1612"); WIDTH16[3] = new Option("14'' (35cm)", "1614"); WIDTH16[4] = new Option("16'' (41cm)", "1616"); WIDTH16[5] = new Option("18'' (45cm)", "1618"); WIDTH16[6] = new Option("20'' (51cm)", "1620"); WIDTH16[7] = new Option("24'' (61cm)", "1624"); WIDTH16[8] = new Option("30'' (76cm)", "1630"); WIDTH16[9] = new Option("36'' (91cm)", "1636"); WIDTH16[10] = new Option("42'' (107cm)", "1642"); WIDTH16[11] = new Option("48'' (122cm)", "1648"); WIDTH18[0] = new Option("8'' (20cm)", "1808"); WIDTH18[1] = new Option("10'' (25cm)", "1810"); WIDTH18[2] = new Option("12'' (30cm)", "1812"); WIDTH18[3] = new Option("14'' (35cm)", "1814"); WIDTH18[4] = new Option("16'' (41cm)", "1816"); WIDTH18[5] = new Option("18'' (45cm)", "1818"); WIDTH18[6] = new Option("20'' (51cm)", "1820"); WIDTH18[7] = new Option("24'' (61cm)", "1824"); WIDTH18[8] = new Option("30'' (76cm)", "1830"); WIDTH18[9] = new Option("36'' (91cm)", "1836"); WIDTH18[10] = new Option("42'' (107cm)", "1842"); WIDTH18[11] = new Option("48'' (122cm)", "1848"); WIDTH18[12] = new Option("60'' (152cm)", "1860"); WIDTH18[13] = new Option("72'' (183cm)", "1872"); WIDTH20[0] = new Option("8'' (20cm)", "2008"); WIDTH20[1] = new Option("10'' (25cm)", "2010"); WIDTH20[2] = new Option("12'' (30cm)", "2012"); WIDTH20[3] = new Option("14'' (35cm)", "2014"); WIDTH20[4] = new Option("16'' (41cm)", "2016"); WIDTH20[5] = new Option("18'' (45cm)", "2018"); WIDTH20[6] = new Option("20'' (51cm)", "2020"); WIDTH20[7] = new Option("24'' (61cm)", "2024"); WIDTH20[8] = new Option("30'' (76cm)", "2030"); WIDTH20[9] = new Option("36'' (91cm)", "2036"); WIDTH20[10] = new Option("42'' (107cm)", "2042"); WIDTH20[11] = new Option("48'' (122cm)", "2048"); WIDTH20[12] = new Option("60'' (152cm)", "2060"); WIDTH20[13] = new Option("72'' (183cm)", "2072"); WIDTH24[0] = new Option("8'' (20cm)", "2408"); WIDTH24[1] = new Option("10'' (25cm)", "2410"); WIDTH24[2] = new Option("12'' (30cm)", "2412"); WIDTH24[3] = new Option("14'' (35cm)", "2414"); WIDTH24[4] = new Option("16'' (41cm)", "2416"); WIDTH24[5] = new Option("18'' (45cm)", "2418"); WIDTH24[6] = new Option("20'' (51cm)", "2420"); WIDTH30[0] = new Option("10'' (25cm)", "3010"); WIDTH30[1] = new Option("12'' (30cm)", "3012"); WIDTH30[2] = new Option("14'' (35cm)", "3014"); WIDTH30[3] = new Option("16'' (41cm)", "3016"); WIDTH30[4] = new Option("18'' (45cm)", "3018"); WIDTH30[5] = new Option("20'' (51cm)", "3020"); WIDTH36[0] = new Option("12'' (30cm)", "3612"); WIDTH36[1] = new Option("14'' (35cm)", "3614"); WIDTH36[2] = new Option("16'' (41cm)", "3616"); WIDTH36[3] = new Option("18'' (45cm)", "3618"); WIDTH36[4] = new Option("20'' (51cm)", "3620"); WIDTH42[0] = new Option("14'' (35cm)", "3614"); WIDTH42[1] = new Option("16'' (41cm)", "3616"); WIDTH42[2] = new Option("18'' (45cm)", "3618"); WIDTH42[3] = new Option("20'' (51cm)", "3620"); WIDTH48[0] = new Option("16'' (41cm)", "4816"); WIDTH48[1] = new Option("18'' (45cm)", "4818"); WIDTH48[2] = new Option("20'' (51cm)", "4820"); WIDTH60[0] = new Option("18'' (45cm)", "6018"); WIDTH60[1] = new Option("20'' (51cm)", "6020"); WIDTH72[0] = new Option("18'' (45cm)", "7218"); WIDTH72[1] = new Option("20'' (51cm)", "7220"); function populateSub(mainSel, subSel){ var mainMenu = mainSel; var subMenu = subSel; var subMenuItems; subMenu.options.length = 1; switch (mainMenu.selectedIndex) { case 0: subMenuItems = SELECT_WIDTH_FIRST; break; case 1: subMenuItems = WIDTH08; break; case 2: subMenuItems = WIDTH10; break; case 3: subMenuItems = WIDTH12; break; case 4: subMenuItems = WIDTH14; break; case 5: subMenuItems = WIDTH16; break; case 6: subMenuItems = WIDTH18; break; case 7: subMenuItems = WIDTH20; break; case 8: subMenuItems = WIDTH24; break; case 9: subMenuItems = WIDTH30; break; case 10: subMenuItems = WIDTH36; break; case 11: subMenuItems = WIDTH42; break; case 12: subMenuItems = WIDTH48; break; case 13: subMenuItems = WIDTH60; break; case 14: subMenuItems = WIDTH72; break; } for (var i = 0; i < subMenuItems.length; i++) { subMenu.options[i] = subMenuItems[i]; } } </script> <div style="width:320px; text-align:right;"> <form name="Menus"> <label style="font-size:14px; font-variant:small-caps;">Width</label> <select style="width:250px; margin-bottom:10px;" name="Width" onchange="populateSub(this, this.form.Height);"> <option>Please Select</option> <option value="W08">8'' (20cm)</option> <option value="W10">10'' (25cm)</option> <option value="W12">12'' (30cm)</option> <option value="W14">14'' (35cm)</option> <option value="W16">16'' (41cm)</option> <option value="W18">18'' (46cm)</option> <option value="W20">20'' (51cm)</option> <option value="W24">24'' (61cm)</option> <option value="W30">30'' (61cm)</option> <option value="W36">36'' (61cm)</option> <option value="W42">42'' (61cm)</option> <option value="W48">48'' (61cm)</option> <option value="W60">60'' (61cm)</option> <option value="W72">72'' (61cm)</option> </select> <label style="font-size:14px; font-variant:small-caps;">Height</label> <select style="width:250px; margin-bottom:10px;" name="Height"> <option>Please Select Width First</option> </select> <input type="button" value="View Canvas!"> </form> </div> As mentioned, Javascript is completely new to me but I am attempting to learn. Any help would be greatly appreciated. Wayne Hi folks. Looking to see if anyone could tell me where I'm going wrong with this script... I'm trying to have a field automatically filled with the day of the week ("Monday", "Tuesday", "Wednesday" and so on), upon the user selecting a date from the datepicker jQuery. If this isn't clear, I'll clarify further down the page. Here is the script: Code: <script type="text/javascript"> jQuery(document).ready(function($){ $('input[name="item_meta[428]"]').change(function(){ var d = $('input[name="item_meta[428]"]').val(); var n = new Date(d).getDay(); if(n == 0) val v = 'Sunday'; else if(n == 1) val v = 'Monday'; else if(n == 2) val v = 'Tuesday'; else if(n == 3) val v = 'Wednesday'; else if(n == 4) val v = 'Thursday'; else if(n == 5) val v = 'Friday'; else if(n == 6) val v = 'Saturday'; $('input[name="item_meta[429]"]').val(v).change(); }); }); </script> I'm basically trying to say, if the user selected today (15/05/2012) in the field 428 it would fill the field 429 with "Tuesday". Again, if the user selected 18/05/2012 in the field 428 then it would automatically fill field 429 with "Friday". It's being done to work in conjunction with a wordpress plugin called Formidable Pro hence the item_meta[428] etc. Any assistance would be greatly appreciated. Sam. Hi folks, i am trying to generate a dynamic datefield with date mask "mm/dd/yyyy" and trying to insert it into Oracle db ...i still got the error ORA invalid month ehich means the date filed is not recognized as date: below is what i am doing : newStartDate = document.createElement( 'INPUT' ); newStartDate.setAttribute('type','Date'); newStartDate.setAttribute('id1','id'+ elementid+elementrow); newStartDate.setAttribute('name','StartDateName'+ elementid+elementrow); newStartDate.size=8; newStartDate.style.backgroundColor= bgc; any help thanks ?? Also i want to add a datepicke to this textbox..how it is posible / other option is to use Jquery datepicker but could not know how to impement it thanks again Hi to all, I need some help checking a date field with javascript, I need to veryfy that the date introduced is not previous from today so when the submit button is clicked an alert comes up: "Date can't be previous from today" the date is compared with a PHP variable with de date from server "$todays_date" in 31/12/2011 format. Code: if (frm.date.value [is previous from] $todays_date) { alert('Date can't be previous from today') frm.date.focus() return false } Any help?? Thanks i need help with the following problem : I installed a new extension on my website , that allows a customer to select a delivery date, by displaying a table where he chooses a date. The script works perfectly but has 1 big downside . I can't make it a *required field . I am running a flower shop so delivery date is mandatory. anyways, i want to know if i can set it to mandatory modifying this code.. Code: <?php class MagentoTeam_Ddc_Block_Form extends Mage_Checkout_Block_Onepage_Abstract{ protected $delivery_date; protected $customer_comment; public function getDeliveryDate(){ if(is_null($this->delivery_date)){ $this->delivery_date = $this->getCheckout()->getQuote()->getDeliveryDate(); } return $this->delivery_date; } public function getCustomerComment(){ if(is_null($this->customer_comment)){ $this->customer_comment = $this->getCheckout()->getQuote()->getCustomerComment(); } return $this->customer_comment; } public function getConfigData($node){ return Mage::getStoreConfig(sprintf('magentoteam_ddc/%s', $node)); } public function getFirstDay(){ return intval(Mage::getStoreConfig('general/locale/firstday')); } } thank you in advance! Hi All, I have a form that captures member registration details. In the admin section .. I would like to change the Status field of a record/s from NEW to PAYMENT DUE after 14 days from the data of submission. The status change should automatically trigger on the 15th day. So when the admin checks the list page he/she should be able to view the updated status field. Any pointers how to accomplish this? Thanks in advance. Vinny I am having some trouble with my code in that I am trying to take the value from the date of birth field and check to see if over 18 years old. I they are not over 18, a window.alert dialog box pops up to tell them. Any help with this I would greatly appreciate. Below is the check if 18 validation. Script section in the document head: Code: //check if over 18 function overAge(){ var age; var input = document.forms[0].birthDate.value; var pyear = parseInt(input.substring(6,10)); var pmonth = parseInt(input.substring(0,2)) - 1; var pday = parseInt(input.substring(3,5)); if ( month < pmonth ){ age = year - pyear - 1; } else if ( month > pmonth ){ age = year - pyear; } else if ( month == pmonth ){ if ( day < pday ){ age = year - pyear - 1; } else if ( day > pday ){ age = year - pyear; } else if ( day == pday ){ age = year - pyear; } } if(age < 18){ window.alert('Attention: Under 18!'); valid=false; return valid; } } Code for body section: Code: Date of Birth: <br/> <input type = "text" name = "date" value = "(mm/dd/yyyy)"/> Hi guys, I have this drag and drop script: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>JavaScript Drag and Drop Tutorial</title> </head> <body> <div style="position:absolute; left:0%; top:0%; "> <style type="text/css"> .drag { position: absolute; } </style> <div style=" position:absolute; width:100%; height = 100%; left:0%; top: 0%" > <input id="1" class="drag" style="width:100px; height:100px; top: 0px" type="submit" value="Drag 'n' throw me"> <pre id="debug"> </pre> </div> <script language="JavaScript" type="text/javascript"> <!-- function $(id){ return document.getElementById(id); } var _startX = 0; // mouse starting positions var _startY = 0; var _offsetX = 0; // current element offset var _offsetY = 0; var _dragElement; // needs to be passed from OnMouseDown to OnMouseMove var _oldZIndex = 0; // we temporarily increase the z-index during drag var _debug = $('debug'); // makes life easier InitDragDrop(); function InitDragDrop() { document.onmousedown = OnMouseDown; document.onmouseup = OnMouseUp; } function OnMouseDown(e){ if (e == null) e = window.event; var target = e.target != null ? e.target : e.srcElement; if ((e.button == 1 && window.event != null || e.button == 0) && target.className == 'drag') { _startX = e.clientX; _startY = e.clientY; _offsetX = ExtractNumber(target.style.left); _offsetY = ExtractNumber(target.style.top); _oldZIndex = target.style.zIndex; target.style.zIndex = 10000; _dragElement = target; document.onmousemove = OnMouseMove; document.body.focus(); document.onselectstart = function () { return false; }; target.ondragstart = function() { return false; }; return false; } } function ExtractNumber(value) { var n = parseInt(value); return n == null || isNaN(n) ? 0 : n; } function OnMouseMove(e) { if (e == null) var e = window.event; // this is the actual "drag code" _dragElement.style.left = (_offsetX + e.clientX - _startX) + 'px'; _dragElement.style.top = (_offsetY + e.clientY - _startY) + 'px'; } function OnMouseUp(e) { if (_dragElement != null) { _dragElement.style.zIndex = _oldZIndex; // we're done with these events until the next OnMouseDown document.onmousemove = null; document.onselectstart = null; _dragElement.ondragstart = null; // this is how we know we're not dragging _dragElement = null; } } </script> </div> </body> </html> Is there a way to drag and drop text field? can someone give me the code to display drop down date with default todays date selected...format dd/mm/yyyy i found the code to display month in mon format..what is to be modified to get in mm format here ______________ <script> var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec']; function populatedropdown(dayfield, monthfield, yearfield){ var today=new Date() var dayfield=document.getElementById(dayfield) var monthfield=document.getElementById(monthfield) var yearfield=document.getElementById(yearfield) for (var i=0; i<31; i++) dayfield.options[i]=new Option(i, i+1) dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day for (var m=0; m<12; m++) monthfield.options[m]=new Option(monthtext[m], monthtext[m]) monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's month var thisyear=today.getFullYear() for (var y=0; y<20; y++){ yearfield.options[y]=new Option(thisyear, thisyear) thisyear+=1 } yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year } </script> Hi I saw on a site one drop down list and i wanted to make it auto change. I mean i have this list in my database and everytime i need to change the date manually. Is it possible that these dates changes every day it display as below but it auto change with day.? and not have Saturday and Sunday in them. Thanks for any help : PHP Code: <select name = "date" value="<?php echo "$date" ?>" id = "date" STYLE="width: 200px; border:1px solid #4088b8; color:#111111; font-family:Arial; background:#ffffff;"> <option value="0" >Please Select</option> <option value="02/11/2009 - Monday" >02/11/2009 - Monday</option> <option value="03/11/2009 - Tuesday" >03/11/2009 - Tuesday</option> <option value="04/11/2009 - Wednesday" >04/11/2009 - Wednesday</option> <option value="05/11/2009 - Thursday" >05/11/2009 - Thursday</option> <option value="06/11/2009 - Friday" >06/11/2009 - Friday</option> <option value="07/11/2009 - Monday" >09/11/2009 - Monday</option> <option value="08/11/2009 - Tuesday" >10/11/2009 - Tuesday</option> <option value="09/11/2009 - Wednesday" >11/11/2009 - Wednesday</option> <option value="10/11/2009 - Thursday" >12/11/2009 - Thursday</option> <option value="11/11/2009 - Friday" >13/11/2009 - Friday</option> <option value="14/11/2009 - Monday" >16/11/2009 - Monday</option> <option value="15/11/2009 - Tuesday" >17/11/2009 - Tuesday</option> <option value="16/11/2009 - Wednesday" >18/11/2009 - Wednesday</option> <option value="17/11/2009 - Thursday" >19/11/2009 - Thursday</option> <option value="18/11/2009 - Friday" >20/11/2009 - Friday</option> <option value="21/11/2009 - Monday" >23/11/2009 - Monday</option> <option value="22/11/2009 - Tuesday" >24/11/2009 - Tuesday</option> <option value="23/11/2009 - Wednesday" >25/11/2009 - Wednesday</option> <option value="24/11/2009 - Thursday" >26/11/2009 - Thursday</option> <option value="25/11/2009 - Friday" >27/11/2009 - Friday</option> <option value="28/11/2009 - Monday" >30/11/2009 - Monday</option> <option value="29/11/2009 - Tuesday" >01/12/2009 - Tuesday</option> <option value="30/11/2009 - Wednesday" >02/11/2009 - Wednesday</option> <option value="01/12/2009 - Thursday" >03/12/2009 - Thursday</option> <option value="02/12/2009 - Friday" >04/12/2009 - Friday</option> </select> Best Wishes I have a form that has a pretty complicated combo box - a user starts typing text, it queries a database for matches, and displays the results to the user. The user can then select the match they desire and it has a value id, which I am currently sending to a hidden field in the form. So, for example: user starts typing in a movie name, Seven - it returns Seven and user selects it. The form submits the id of the movie seven (say 12) to a hidden field. Where I am stumped: Once a user selects a movie title, I have another drop down select box that is to display the available formats of the movie by querying my database based on the product id (12) and returning the available formats in the list: DVD BLUERAY VHS I am pretty good at programming, but I cannot figure this out - how to make the select box fire and return results once the value for the textbox has been captured. Can anyone help me? Hi coders, I need to achieve two things upon making a selection from a drop down field: 1) Changing the background picture of a cell. 2) Changing the size of a uploaded foreground picture within the same cell. Code: <select name=ADDITIONALINFO> <option value="25 x 25">25 x 25</option> <option value="35 x 35">35 x 35</option> <option value="45 x 45">45 x 45</option> <option value="55 x 55">55 x 55</option> </select> Any guidance how to achieve this is appreciated. This javascript code is supposedly to show the current date, and show a famous person's birthday on each day. Not sure if I am suppose to have birthdates in js files, or in first files. [CODE]Filename: births.htm Supporting files: functions.js, logo.jpg --> <title>Welcome to Happy Birthday.com</title> <link href="styles.css" rel="stylesheet" type="text/css" /> <script language="JavaScript" type="text/javascript"> var births = new Array(); births[1] = "J.D. Salinger (1919) - Author"; births[2] = "Isaac Asimov (1920) - Author"; births[3] = "Clement Attlee (1883) - 42 Prime Minister"; births[4] = "Floyd Patterson (1935) - Heavyweight boxer"; births[5] = "King Camp Gillette (1855) - Invented safety razor"; births[6] = "Mel Gibson (1956) - Actor"; births[7] = "Millard Fillmore (1800) - 13th US President"; births[8] = "Elvis Aaron Presley (1935) - King of rock 'n' roll"; births[9] = "Richard Nixon (1913) - 37th US President"; births[10] = "George Foreman (1949) - Heavyweight boxing champ"; births[11] = "Alexander Hamilton (1755) - American Founding Father"; births[12] = "Joe Frazier (1947) - Heavyweight boxing champ"; births[13] = "Orlando Bloom (1977) - Actor"; births[14] = "Benedict Arnold (1741) - American"; births[15] = "Martin Luther King (1929) - Civil-rights "; births[16] = "Andre Michelin (1853) - Inventor of rubber tires"; births[17] = "Muhammad Ali (1942) - Boxer Cassius Clay"; births[18] = "David D Kaminsky (1913) - Danny Kaye"; births[19] = "James Watt (1736) - Inventor of the steam engine"; births[20] = "Edwin 'Buzz' Aldrin (1930) - Second man on Moon"; births[21] = "Telly Savalas (1924) - Actor"; births[22] = "Sam Cooke (1935) - Singer"; births[23] = "Princes Caroline (1957) - Royal of Monaco"; births[24] = "John Belushi (1949) - Actor"; births[25] = "Robert Burns (1759) - Scottish poet"; births[26] = "Paul Newman (1925) - Actor"; births[27] = "Amadeus Mozart (1756) - Composer"; births[28] = "Elijah Wood (1981) - Actor"; births[29] = "William McKinley (1843) - American President"; births[30] = "Franklin D. Roosevelt (1882) - American President"; births[31] = "Mario Lanza (1921) - Tenor singer"; births[32] = "Clark William Gable (1901) - Actor"; births[33] = "James Joyce (1882) - Author"; births[34] = "Gertrude Stein (1874) - Author"; births[35] = "Charles Lindbergh (1902) - Aviator"; births[36] = "John Boyd Dunlop (1840) - Inventor of the pneumatic tire"; births[37] = "Ronald Reagan (1911) - 40th US President"; births[38] = "Charles Dickens (1812) - Author"; births[39] = "James Dean (1931) - Actor"; births[40] = "Sandy Lyle (1958) - British golfer"; births[41] = "Harold Macmillan (1894) - 44th UK Prime Min"; births[42] = "Thomas Alva Edison (1847) - Inventor of the electric light bulb"; births[43] = "Abraham Lincoln (1809) - 16th US President"; births[44] = "George Segal (1934) - Actor"; births[45] = "Jimmy Hoffa (1913) - Union Leader"; births[46] = "Galileo Galilei (1564) - Italian astronomer"; births[47] = "John McEnroe (1959) - Tennis player"; births[48] = "Michael Jordan (1963) - Basketball player"; births[49] = "Enzo Ferrari (1898) - Sports car builder"; births[50] = "Prince Andrew (1960) - Queens 3rd child"; births[51] = "Sidney Poitier (1927) - First black Oscar win"; births[52] = "Jilly Cooper (1937) - Author"; births[53] = "George Washington (1732) - 1st US President"; births[54] = "Linda Nolan (1959) - Singer" births[55] = "Steven Jobs (1955) - Software pioneer"; births[56] = "George Harrison (1943) - Ex-Beatle guitarist"; births[57] = "William F Cody (1846) - Buffalo Bill"; births[58] = "Elizabeth Taylor (1932) - Actress Oscar winner"; births[59] = "Barry McGuigan (1961) - Featherweight boxer"; births[60] = "Gioacchino Rossini (1792) - William Tell Overture"; births[61] = "Glen Miller (1904) - Bandleader"; births[62] = "Mikhail Gorbachev (1931) - Soviet President"; births[63] = "Alexander G Bell (1847) - Inventor of telephone"; births[64] = "Patrick Moore (1923) - Astronomer"; births[65] = "William Oughtred (1574) - Inventor of the slide rule"; births[66] = "Valentine Tereshkova (1937) - First woman in space"; births[67] = "Armstrong Jones (1930) - Lord Snowdon (photographer)"; births[68] = "Karl Von Grafe (1787) - Plastic surgery pioneer"; births[69] = "Yuri Gagarin (1934) - First man in space"; births[70] = "Chuck Norris (1942) - Karate film actor"; births[71] = "Sir Harold Wilson (1916) - 46th UK Prime Min"; births[72] = "Liza Minnelli (1946) - Actress"; births[73] = "Joseph Priestley (1733) - Discoverer of oxygen gas"; births[74] = "Albert Einstein (1879) - Theory of relativity"; births[75] = "Andrew Jackson (1767) - 7th US President"; births[76] = "George Ohm (1787) - Measure of electricity"; births[77] = "Gottlieb Daimler (1834) - Inventor of the combustion engine"; births[78] = "Neville Chamberlain (1869) - 40th UK Prime Min"; births[79] = "David Livingstone (1813) - Explorer"; births[80] = "Mr. Rodgers (1928) - Children's entertainer"; births[81] = "Johann Sebastian Bach (1685) - Composer"; births[82] = "Andrew Lloyd Webber (1948) - British songwriter"; births[83] = "Sir Roger Bannister (1948) - First runner to break the four-minute mile"; births[84] = "Steve McQueen (1930) - Actor"; births[85] = "Reginald K Dwight (1947) - Singer Elton John"; births[86] = "Diana Ross (1944) - Singer"; births[87] = "Henry Royce (1863) - Co founder of Rolls-Royce"; births[88] = "Neil Kinnock (1942) - Former Labour leader"; births[89] = "John Major (1947) - 50th UK Prime Min"; births[90] = "Vincent Van Gogh (1854) - Dutch painter"; births[91] = "Gordie Howe (1928) - Hockey player"; births[92] = "William Harvey (1578) - Discoverer of blood circulation"; births[93] = "Hans Chris Andersen (1805) - The Ugly Duckling"; births[94] = "Doris Kappelhoff (1924) - Doris Day (actress)"; births[95] = "Maya Angelou (1928) - Poet"; births[96] = "Lord Joseph Lister (1827) - Introduced antiseptic"; births[97] = "Harry Houdini (1874) - Escape artist"; births[98] = "William Wordsworth (1843) - Poet"; births[99] = "Julian Lennon (1963) - Singer"; births[100] = "Isambard Brunel (1806) - Engineer of the Thames tunnel"; births[101] = "Michel Shalhouz (1932) - Actor Omar Sharif "; births[102] = "Joel Grey (1932) - Actor"; births[103] = "Tom Clancy (1947) - Author"; births[104] = "Garry Kasparov (1963) - British chess champ"; births[105] = "Rod Steiger (1925) - Acotr"; births[106] = "Leonardo da Vinci (1452) - Genius"; births[107] = "Charlie S Chaplin (1889) - Silent comedy actor"; births[108] = "Nikita Krushchev (1894) - Soviet leader"; births[109] = "Hayley Mills (1946) - Child star actress"; births[110] = "Dudley Moore (1935) - Actor 'Arthur' and '10'"; births[111] = "Adolf Hitler (1889) - German leader"; births[112] = "Queen Elizabeth II (1926) - Head of British Commonwealth"; births[113] = "Jack Nicholson (1938) - Actor"; births[114] = "William Shakespeare (1564) - Playwright and Poet"; births[115] = "Barbra Streisand (1942) - Singer"; births[116] = "Ella Fitzgerald (1918) - Singer"; births[117] = "Jet Li (1963) - Actor"; births[118] = "Samuel Morse (1791) - Inventor of Morse Code"; births[119] = "Saddam Hussein (1937) - Deposed Iraq President"; births[120] = "Hirohito (1901) - Emperor of Japan"; births[121] = "Kath Smith (1909) - Singer"; births[122] = "Duke of Wellington (1769) - 23rd UK Prime Min"; births[123] = "Harry (Bing) Crosby (1904) - Singer/Actor"; births[124] = "Arnold G Dorsey (1936) - Engelbert Humperdink"; births[125] = "Michael Barrymore (1952) - Entertainer"; births[126] = "Tammy Wynette (1942) - Singer"; births[127] = "Sigmund Freud (1856) - Psychoanalysis"; births[128] = "Johannes Brahms (1833) - German composer"; births[129] = "Harry S Truman (1884) - 33rd US President"; births[130] = "Glenda Jackson (1936) - Actress"; births[131] = "Fred Astaire (1899) - Actor and tap-dancer"; births[132] = "Phil Silvers (1912) - Actor"; births[133] = "Florence Nightingale (1820) - Crimean war nurse"; births[134] = "Stevie Wonder (1950) - Singer"; births[135] = "Thomas Gainborough (1727) - Landscape painter"; births[136] = "James Mason (1909) - Actor"; births[137] = "Henry Fonda (1905) - Actor"; births[138] = "Grace Jones (1955) - Singer"; births[139] = "Karol Wojtyla (1920) - Pope John Paul II"; births[140] = "Pete Townshend (1945) - Singer"; births[141] = "James M Stewart (1908) - Comedy actor"; births[142] = "Leo Sayer (1948) - Singer"; births[143] = "Laurence Olivier (1907) - Actor"; births[144] = "Joan Collins (1933) - Film & TV actress"; births[145] = "Queen Victoria (1819) - Longest reigning Queen"; births[146] = "Miles Davis (1926) - Musician"; births[147] = "Marion Morrison (1907) - Actor John Wayne"; births[148] = "Vincent Price (1911) - Horror movie actor"; births[149] = "Ian Fleming (1908) - Author"; births[150] = "John F Kennedy (1917) - 35th US President"; births[151] = "Peter the Great (1672) - Emperor of Russia"; births[152] = "Clint Eastwood (1930) - Actor"; births[153] = "Norma Jean Baker (1926) - Marilyn Monroe"; births[154] = "Johnny Weissmuller (1903) - Actor"; births[155] = "King George V (1865) - 2nd son of Edward VII"; births[156] = "Christopher Cockerel (1910) - Inventor of the hovercraft"; births[157] = "John Couch Adams (1819) - British Astronomer"; births[158] = "Robert Falcon Scott (1868) - 1st Brit to South Pole"; births[159] = "Tom Jones (1940) - Singer"; births[160] = "Nancy Sinatra (1940) - Singer"; births[161] = "George Stephenson (1781) - Inventor of the first steam locomotive"; births[162] = "Judy Garland (1922) - Singer"; births[163] = "Vince Lombardi (1913) - Coach of the Green Bay Packers"; births[164] = "George Herbert Bush (1924) - 41st US President"; births[165] = "Tim Allen (1953) - Actor"; births[166] = "Boy George (1961) - Singer "; births[167] = "Mario Cuomo (1932) - Former governor of New York"; births[168] = "Stan Laurel (1890) - Laurel & Hardy duo"; births[169] = "Barry Manilow (1946) - Singer"; births[170] = "Paul McCartney (1942) - Singer"; births[171] = "Blaise Pascal (1623) - French mathematician"; births[172] = "Errol Flynn (1909) - Action-adventure film"; births[173] = "Prince William (1982) - Prince & Princess Wales son"; births[174] = "Meryl Streep (1949) - Actress"; births[175] = "Charles R Darwin (1809) - Theory of evolution"; births[176] = "Jack Dempsey (1895) - Heavyweight boxing"; births[177] = "Eric Arthur Blair (1903) - George Orwell"; births[178] = "William T Kelvin (1827) - Inventor of the absolute temperature scale"; births[179] = "Helen Keller (1880) - Author"; births[180] = "Mel Brooks (1926) - Writer/Actor"; births[181] = "Nelson Eddy (1901) - Singer"; births[182] = "Mike Tyson (1966) - Boxer"; births[183] = "Dianna Spencer (1961) - Princess Diane"; births[184] = "Richard Petty (1937) - Racecar driver"; births[185] = "Tom Cruise (1962) - Actor"; births[186] = "Calvin Coolidge (1872) - American president"; births[187] = "Bjorn Borg (1980) - Wimbledon tennis champion"; births[188] = "Bill Haley (1925) - Singer"; births[189] = "Richard Starkey (1940) - Ringo Starr"; births[190] = "Ringo Starr (1940) - Ex-Beatle drummer"; births[191] = "Sir Edward Heath (1916) - 47th UK Prime Min"; births[192] = "Virginia Wade (1945) - Tennis champion"; births[193] = "Yul Brynner (1917) - Actor"; births[194] = "Josiah Wedgwood (1730) - Blue & white pottery"; births[195] = "Harrison Ford (1942) - Actor"; births[196] = "Gerald Rudolph Ford (1913) - 38th US President"; births[197] = "Rembrandt (1606) - Dutch artist & painter"; births[198] = "Roald Amundsen (1872) - First man to reach the South Pole"; births[199] = "James Cagney (1899) - Actor"; births[200] = "John Glenn (1921) - First man to orbit Earth"; births[201] = "Samuel Colt (1814) - Inventor of the colt revolver"; births[202] = "Sir Edmund Hillary (1919) - First to climb Mt. Everest"; births[203] = "Ernest Hemingway (1899) - Author"; births[204] = "Bob Dole (1923) - Former U.S. Senator"; births[205] = "Monica Lewinsky (1973)"; births[206] = "Amelia Earhart (1898) - 1st woman to fly Atlantic"; births[207] = "Arthur James Balfour (1848) - 33rd UK Prime Min"; births[208] = "Mick Jagger (1944) - Singer"; births[209] = "Joseph Hilary Belloc (1870) - Author"; births[210] = "Beatrix Potter (1866) - Author"; births[211] = "Peter Jennings (1938) - Journalist"; births[212] = "Emily Bronte (1818) - Wuthering Heights"; births[213] = "J. K. Rowling (1965) - Author"; births[214] = "Herman Melville (1819) - Author"; births[215] = "Peter O'Toole (1932) - Lawrence of Arabia"; births[216] = "Stanly Baldwin (1868) - 38th UK Prime Min"; births[217] = "Queen Elizabeth (1900) - King George 6th wife"; births[218] = "Neil Armstrong (1930) - First man on the Moon"; births[219] = "Andy Warhol (1928) - Artist"; births[220] = "Mata Hari (1876) - Spy for the Germans"; births[221] = "Dustin Hoffman (1937) - Actor"; births[222] = "Thomas Telford (1757) - Road & bridge Engineer"; births[223] = "Herbert Clark Hoover (1874) - 31st US President"; births[224] = "Enid Blyton (1897) - Author"; births[225] = "King George 4th (1762) - King of England"; births[226] = "John Logie Baird (1888) - Inventor of television"; births[227] = "John Galsworthy (1867) - Author"; births[228] = "Napoleon Bonaparte (1769) - French leader"; births[229] = "Madonna (1959) - Singer"; births[230] = "May West (1892) - Actress"; births[231] = "Robert Redford (1937) - Actor"; births[232] = "Orville Wright (1871) - Inventor of the first airplane"; births[233] = "Jim Reeves (1924) - Singer"; births[234] = "William Murdock (1754) - Inventor of coal-gas lighting in 1792"; births[235] = "Ray Bradbury (1920) - Author"; births[236] = "Gene Kelly (1912) - Actor/Dancer"; births[237] = "Craig Kilborn (1962) - Actor"; births[238] = "Sean Connery (1930) - Actor"; births[239] = "Robert Walpole (1676) - 1st UK Prime Minister"; births[240] = "Sam Goldwyn (1910) - Film producer"; births[241] = "David Soul (1828) - Actor"; births[242] = "Michael Jackson (1958) - Singer"; births[243] = "Denis Healey (1917) - Politician"; births[244] = "Sir Bernard Lovell (1928) - Inventor of the radio telescope"; births[245] = "Rocky Marciano (1923) - Heavyweight boxer"; births[246] = "Salma Hayek (1968) - Actress"; births[247] = "Alan Ladd (1913) - Actor"; births[248] = "Tom Watson (1949) - Golfer"; births[249] = "Raquel Welch (1940) - Actress"; births[250] = "Britt Ekland (1942) - Actress"; births[251] = "Queen Elizabeth I (1533) - Queen of England"; births[252] = "King Richard I (1157) - Richard the Lion Heart"; births[253] = "William Bligh (1754) - Mutiny on the Bounty"; births[254] = "Arnold Palmer (1929) - US golfing champion"; births[255] = "O. Henry (1862) - Author"; births[256] = "Richard Gatling (1818) - Inventor of the Gatling Gun"; births[257] = "Claudette Colbert (1905) - Actress"; births[258] = "Jack Hawkins (1910) - British film actor"; births[259] = "Agatha Christie (1891) - Detective storywriter"; births[260] = "B. B. King (1925) - Musician"; births[261] = "John Ritter (1948) - Actor"; births[262] = "Samuel Johnson (1709) - 18th century writer"; births[263] = "George Cadbury (1839) - Chocolate manufacturer"; births[264] = "Sophia Loren (1934) - Italian film actress"; births[265] = "H G Wells (1866) - Science fiction novelist"; births[266] = "Michael Faraday (1791) - Inventor of the electric generator 1831"; births[267] = "Julio Iglesias (1943) - Singer"; births[268] = "Anthony Newley (1931) - Actor"; births[269] = "Meat Loaf (1947) - Singer"; births[270] = "George Gershwin (1898) - Composer"; births[271] = "Mike Schmidt (1949) - Baseball player"; births[272] = "Lech Walesa (1943) - Founder of Solidarity"; births[273] = "Horatio Nelson (1758) - Commander"; births[274] = "Johnny Mathis (1935) - Singer"; births[275] = "Jimmy Carter (1924) - 39th American President"; births[276] = "Mahatma K Gandhi (1869) - Hindu spiritual leader"; births[277] = "Chubby Checker (1941) - Singer"; births[278] = "Buster Keaton (1895) - Silent film comedy actor"; births[279] = "Donnald Pleasence (1919) - Actor"; births[280] = "George Westinghouse (1846) - Inventor of the railway air brake"; births[281] = "Yo-Yo Ma (1955) - Musician"; births[282] = "R. L. Stine (1943) - Author"; births[283] = "John Lennon (1940) - Beatles song writer"; births[284] = "William Morris (1877) - Motoring pioneer"; births[285] = "Henry J Heins (1844) - Food products manufacturer"; births[286] = "Ramsay MacDonald (1866) - 39th British Prime Minister"; births[287] = "Margaret H Thatcher (1925) - First woman Prime Minister"; births[288] = "Dwight Eisenhower (1890) - 34th American President"; births[289] = "John L Sullivan (1858) - World heavyweight boxing champion"; |