I have 2 different dropdowns lists. One for the month and another for the days (shows the date)
by default when the page is loaded, I am showing January in the first dropdown and 1 in the second dropdown (date).
But if a user selects February from the month dropdown list, I just dont want to show 29th, 30th, 31st etc. Same applicable for say april, june, sept etc where I dont want to show 31st so the user will not be able to select wrong date for a month. How can I do this?
i need one script just we select the month and year in calender.what we select the month and year that month and year respective data should be shown in the table.
I am trying to create simple JS code for two drop down lists...and I am unable to made anything work. Here are the specs:
On my asp page, I need two drop down lists, the first for a four position year (2006, 2005 , 2004, etc) and the second is for two position month. The hook is that I would like them to dynamically update in relation to the present date. Example...present month and year is 03/06. If I select 񟭆' from the year drop down - my only options for the month dropdown should be ༿', ༾', & ༽'. Next month (04/06), my options for the month dropdown should be ཀ', ༿', ༾', & ༽'. If I select 񟭅' - my options for the month drop down should include all 12 months.
I would like this to update dynamically...with no hard coded dates. The range would be now to 5 years prior. It seems like it should be easy but I just can't get the darn thing.
I've come across this archive at [URL]. What I would like is to have it to have it include "days" as well. So lets say as of today (Apr 8th), when a user choose Apr, the dropdown for 'day' will have the options 01, 02, 03.....08. Another thing to note is that each month has different number of days in it. I've tried playing around for quite some time now...but so far no luck.
I am working on a series of functions that I keep getting asked about. The following three scripts do this: --Date Validation --Calculate Difference Between Dates --Date Addition or Subtraction
I am sure that these have been done before, but I just filled the last 20 minutes by coding these. I only did a quick browser test, nothing extensive. <script> //Date Validation function DateValid(mo, dy, yr){ TheDate = mo+"/"+dy+"/"+yr; Date1 = new Date(TheDate) D=Date1.getDate(); M=Date1.getMonth()+1; Y=Date1.getYear(); [Code] .....
I'm having trouble figuring out exactly how to write the confirmation/validation for the card expiration choices compared to the current date. I have the month and year choices in selection menus, as opposed to text boxes. Code:
I have 4 text boxes that are supposed to load 4 seperate values of data from one field in one table from a database. The field is called interface_cropsettings (from the interface table) and these values have been concatenated and comma seperated in this field.
Code:
Once the form is filled out and saved, the data is inserted into the database and the values from these 4 text boxes are concatenated, comma seperated and inserted into that one field correctly.
(Example)
If the 4 text boxes have the following values:
In the database field they become:
However, if the form is closed and then re-opened, each text box displays the entire database field rather then each value seperated in the corresponding text box.
(Example)
All 4 text boxes display this:
I already know why the data appears like this in the form, my problem is that I'm not sure how to write the javascript to seperate the values into the correct corresponding fields, assuming javascript is what I should be using!
Also, this is kind of irrelevant but just in case you're wondering, this form is part of a cold fusion application!
I have just found this wonderful forum through Dr Google whilst looking for an answer to my incredibly frustrating question! I am an OU student it is for an assignment I just cannot find the answer in any of the books and searching the net has got me nothing but so far wasted 3 hours :(
Here is the code snippet:
First I had to add a new array called totalVotes and assign a length to it the same as candidateArray, I have done this in the last 2 lines I think this is correct, the question did stipulate that if the candidate array was changed then so would the total votes array hence linking it via length.
Now here is where I am at a complete loss :( The exact wording is as follows:
Use a for loop to calculate the total votes for each candidate according to the following structured english:
For each array position add the element at that position in the online vote array to the element at the position in the paper vote array. store the result at the corresponding position in the total votes array end for.
I have 4 text boxes that are supposed to load 4 seperate values of data from one field in one table from a database. The field is called interface_cropsettings (from the interface table) and these values have been concatenated and comma seperated in this field.
Code:
Once the form is filled out and saved, the data is inserted into the database and the values from these 4 text boxes are concatenated, comma seperated and inserted into that one field correctly.
(Example)
If the 4 text boxes have the following values:
In the database field they become:
However, if the form is closed and then re-opened, each text box displays the entire database field rather then each value seperated in the corresponding text box.
(Example)
All 4 text boxes display this:
I already know why the data appears like this in the form, my problem is that I'm not sure how to write the javascript to seperate the values into the correct corresponding fields, assuming javascript is what I should be using!
Also, this is kind of irrelevant but just in case you're wondering, this form is part of a cold fusion application!
I have 41 <select> fields in a form. When a user makes any selection or change to any dropdown I want to do ajax and send the values of 41 dropdown's to a php page which will compute the values and return a single value which should be displayed in a div.
I have been using PHP for a little while but just getting into JavaScript and really need to dynamically update dropdown boxes read from a mySQL database. There are three dropdown boxes, the first reads in fine. The second dropdown box then gets populated using the selection from the first as the condition in mySQL and the same again for the third.The page refreshes itself after the selection from the first box using JavaScript and populates the second using the PHP _GET method (this works fine). The issue is when I need to do this again for the second time because my JS is only set up to do it once and I don't no how to amend it. Also it will have to do it a third time because I need that info to complete the form and update the DB.
<SCRIPT language=JavaScript> function reload(form){ var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='bookf.php?cat='+val ; } </script>
echo "<form method=post name=f1 action=''>"; ////////// Starting of first drop downlist ///////// echo "<select name='cat' onchange="reload(this.form)"><option value=''>Select a Film</option>"; while($noticia2 = mysql_fetch_array($quer2)) { if($noticia2['FilmID']==@$cat){echo "<option selected value='$noticia2[FilmID]'>$noticia2[FilmTitle]</option>"."<BR>";} else{echo "<option value='$noticia2[FilmID]'>$noticia2[FilmTitle]</option>";} }
echo "</select><br />"; ////////////////// This will end the first drop down list /////////// ////////// Starting of second drop downlist ///////// echo "<select name='subcat' onchange="reload(this.form)"><option value=''>Select a Date</option>"; while($noticia = mysql_fetch_array($quer)) { if($noticia2['FilmID']==@$cat){echo "<option selected value='$noticia2[FilmID]'>$noticia2[Date]</option>"."<BR>";} else{echo "<option value='$noticia[FilmID]'>$noticia[Date]</option>";} } echo "</select><br />"; ////////////////// This will end the second drop down list ///////////
////////// Starting of third drop downlist ///////// echo "<select name='subcat2' onchange="reload(this.form)"><option value=''>Select a Time</option>"; while($noticia = mysql_fetch_array($quer3)) { if($noticia2['FilmID']==@$cat){echo "<option selected value='$noticia2[FilmID]'>$noticia2[Time]</option>"."<BR>";} else{echo "<option value='$noticia[FilmID]'>$noticia[Time]</option>";} } echo "</select><br />"; ////////////////// This will end the third drop down list ///////////
I have a form with two single-choice dropdowns. Upon doing an onChange event on either one of them, I want to check to see if the other dropdown has also been selected. How would I do that, considering that this.parent causes an error "null or not an object"?
Does anyone know how to event capture on an autocomplete dropdown - this would not be the underlying html element but only on the autocomplete dropdown itself.
I've never come across trying to capture autocompletes before (in fact, ideally i'm trying to ignore keypresses on the autocomplete and only capture those for the underlying input).
How would I make my page I have connect to a database using javascript dependent dropdowns? I have all the things I need to get the database working where it displays all the info in the database but I only want it to display based on what they select not all of it.
I'm trying to get a pair of drop down menus to appear on the screen, one containing months, and one containing years. I know the one containing years works, since it hasn't been changed at all since it was working, but the month box used to be a textbox. I tried to convert it over to drop down box using the same code as the year box, but it hasn't seemed to work.
<script language="Javascript"> var m1 = January; var m2 = February; var m3 = March; var m4 = April; var m5 = May; var m6 = June; var m7 = July; var m8 = August; var m9 = September; var m10 = October; var m11 = November; var m12 = December; .....
document.write('<select name="selYear">'); for (var x=0; x <= 10; x++ ) { if(x != 5){ document.write('<option value="' + x + '">' + yearArray[x] + '</option>'); }else{ document.write('<option value="' + x + '" selected>' + yearArray[x] + '</option>'); }} document.write('</select>'); </SCRIPT>
I am in a problems here trying to generate link by two dropdown boxes. So, I wanted it to be like when user selects some option from dropdown one the href attribute changes, index.php?staticvar=something&dynvar1=something, that is something I have already managed to do:
function change_href(id) { if (id != '') { var dynvar1 = document.getElementById("s"+id).value; document.getElementById(id).href = "index.php?staticvar="+id+"&dynvar1="+dynvar1; return; } else { return false; } } This works perfectly for me, but now I need to modify the href with another variable, so it would be needed to be like: index.php?staticvar=something&dynvar1=something&dynvar2=something2
The problem is that I don't know how to make it the way that user can change their selections, for example if user first selects (from dropdown) dynvar1 to be "test" and dynvar2 to be "test3", but then changes hes mind and decides to re-select dynvar2 to be "test4". It would be needed to be like only the dynvar2 part of the href changes with proper value (not changing the dynvar1 or staticvar).
I managed to make it changeable but it was like this: index.php?staticvar=something&dynvar1=something&dynvar2=123&dynvar2=123
So, it didn't update the dynvar2 part, but instead just added another dynvar2 variable.
I have a main page ('index.php') with an iframe ('mainframe') on the left hand side. All the links on the index page load a new page of mainly text content into the iframe.
All pretty straightforward, but I am using some javascript to launch and hide a floating div on the index page (if I launch it in the iframe, it will be restricted to the height and width of that frame). The code to show / hide the div is located on the page index.php - say the function is called 'showMe()', I would call top.showMe() to launch the div.
The Div works fine, but when I try and catch an event via:
event.srcelement
it returns the error message 'object required', because it is being passed from a link on a totally seperate page (the iframe)...
Is there any method for the main page (index.php) to catch the event on 'mainframe' that triggers the div ?
The div's do show up and hide, and I can load source content into them - only error messages keep flashing up on IE (but not on Netscape / Firefox, etc).
How can I use XMLHttpRequest communicate from webpage to another? Currently I have a left/right frames, when the submit button pressed (item is added to the database), the left frame should automatically retrieve this item and display it on the page.
I thought of using Ajax (XMLHttpRequest object), but not sure how to use XMLHttpRequest object in two different webpages.