SEARCH YOUR SOLUTION HERE  

Help describing functions

Basically i have to walk my lecturer through this code later on today


Javascript Calander function is_leap(year) { if(year % 400 == 0) return 1; if(year % 100 == 0) return 0; if(year % 4 == 0) return 1; return 0; } function daysInMonth(year, month) { if (month == 9 || month == 4 || month == 6 || month == 11) return 30; if (month != 2) return 31; return (28+is_leap(year)); } function dayOfWeekFirstOfMonth(year,month) { var dayNumber = 1 if( year > 1900) for(i=1900;i 1) { for (i=1; i 1900) for(i=1900;i 1) { for (i=1; i

Posted On: Monday 26th of November 2012 10:10:38 PM Total Views:  364
View Complete with Replies




Related Messages:

java script help for making webpage sample.?   (152 Views)
i am trying to create a webpage. In creating webpage i have troubling by java script. I have to make a drop down button. The elements of drop down button are pakistan afganistan india. Question is, when i click on pakistan then cities of Pakistan must be show, same if i click on afganistan then cities of afganistan must be shown, same as india, when i clicked at india then cities of india must shown, in another dropdown box. After that when i click on india. then there city. then a message window must be appear with Message "Chuck dai india", sane as pakistan "Pakistan is world champion", and with afganistan "Afganistan is neighbour of pakistan" Can u tell me java script use for it. Please give me proper code and tell me reference of website. I am new to java script.
Need help with form submission   (143 Views)
, I am designing my website and I want people visiting my site to be able to submit a form. However, if they submit a form, I would like to require certain information to be submitted. I got a script from Dynamic Drive that is supposed to do that but here is the problem. Inside the form tag it has this code-"form name="formcheck" onsubmit="return formCheck(this); " As you can see, there is not a "Action" or "Method" shown. So can someone tell me what I will need to do to cause this script, if form validation occurs, to send me the info from form in an E-Mail. Thank you.
plzzzz help me with javascript code   (136 Views)
hey u all code master...plzz help me...i need complete javascript code whichlist all files that are in a folder......is it possibl;e in javascript or not to list the files..... for exam ..in c:\Books\...i have five file...then i need a javascript code which list all the file on a hml page......
Urgently need help!!!   (155 Views)
Can anyone send me a simple, understandable javascript code for form validation, including e-mail validation,name validation , password validation etc. pls! send me in hurry!!!:'(
help!   (146 Views)
, Here's what I'm interested in doing but can't get working. In my webpage, the user can visualize some information from the database and eventually choose to edit it. ( this is done with AJAX). When the user clicks on "edit" the appropriate section is refreshed such that the aforementioned information appears in a text input and can now be modified by the user. What I would like to do next, is to take this modified information, associate it with a new variable and send it to the database to replace the old information - this is done after clicking a "save" button. (Again done with AJAX). However I'm having difficulties with this as I do not know how to associate the new information from the text input to a new variable. Perhaps there is a more intelligent way Any ideas are welcome! Best from Brussels, TMT000
designer seeking help with javascript menu   (161 Views)
I'm a graphic designer with very little HTML knowledge who has inherited the maintenance of non-profit agency's website. They have javascript drop-down menus as the part of their main navigation. Up until now, I've only had to change the text or change the size of the menus. But now, they've asked me to add a new menu to one of the buttons. I was hoping it would be simple "copy & paste" of the following code to create a new menu but I've tried it and it is isn't working. My guess is that it has something to do with the 'mm_menu_0623105927_3' but I really have no idea. Can someone shed some light window.mm_menu_0623105927_3 = new Menu("root",140,24,"Arial, Helvetica, sans-serif",10,"#ffffff","#ffffff","#ff9900","#ffc700","left","middle",5,0,1000,1,-1,true,false,true,0,false,true); mm_menu_0623105927_3.addMenuItem("FORMS & APPLICATIONS","window.open('downloads/forms.htm', '_self');"); mm_menu_0623105927_3.addMenuItem("MEDIA","window.open('downloads/media.htm', '_self');"); mm_menu_0623105927_3.hideOnMouseOut=true; mm_menu_0623105927_3.menuBorder=0; mm_menu_0623105927_3.menuLiteBgColor='#ffffff'; mm_menu_0623105927_3.menuBorderBgColor='#ffffff'; mm_menu_0623105927_3.bgColor='#ffffff'; The live site is at http://www.jcyc.org . (They want me to add a menu to the 'Contact Us' button) Thank you in advance., I assume that u have ur if statement and return function to where ever site ur editing, What I suggest u do for now is to change the last digit of ur submenu\MenuItem.... That is (eg.) in ur case if the last digit of downloads is 3 then for contact us u changed it to 4 U can try this and see if its gona work window.mm_menu_0623105927_4 = new Menu("root",140,24,"Arial, Helvetica, sans-serif",10,"#ffffff","#ffffff","#ff9900","#ffc700","left","middle",5,0,1000,1,-1,true,false,true,0,false,true); mm_menu_0623105927_4.addMenuItem("The menu u want to add","window.open('Contact Us/forms.htm', '_self');"); mm_menu_0623105927_4.hideOnMouseOut=true; mm_menu_0623105927_4.menuBorder=0; mm_menu_0623105927_4.menuLiteBgColor='#ffffff'; mm_menu_0623105927_4.menuBorderBgColor='#ffffff'; mm_menu_0623105927_4.bgColor='#ffffff';
Please help!!   (146 Views)
Javascript newbie help!   (200 Views)
quick question, I am a newbie, first with this site, and with programming. this is my first semester and I am learning the basics. I am having a problem with Javascript. this simple code is supposed to just create a web page with the tile , my name and then I am supposed to add text to the page (using astericks), according to the visitor input information. I have the code working to the point of asking which object (right trangle, left triangle, isoceles triangle or rectangle), I have it then alerting the question about the height of the object, (the while loop i have in there set to give an invalis response it working well, the problem I have it getting the actual text on the page in the shape of the object as astericks, anytime I use the document.write(), i get a number (from the user) that screams across the page and gives me a scriptting error. This is probably something simple, dont laugh too hard. O have tried several different ways and used the w3schools website for more info and cant seem to get this to work. any suggestions, maybe another website with more examples.
need help requiring at least one checkbox from group?   (141 Views)
I'm using classic ASP here, and trying to do some Javascript validation. In my form, I'm dynamically creating checkbox groups - each group has a common Name, and each checkbox has a unique ID. Before the form submits (in the onclick on the submit button) I want to check and make sure each checkbox group has at least one of it's checkboxes checked. If that makes sense :-) I guess I'm conceptually running into problems. I think I want to, on submit, loop through all of the checkbox Names, and make sure at least one item is checked out of each of those Name groups. Can this be done This is what I have so far, but I think it's getting thrown off by using the ID instead of the Name: function validateCheckBox() { var checkSelected = false; var checkboxid for(i=0; i
help me please   (153 Views)
hi, please i want to make function java script that check if user enter empty string((" ") more one space) or no if yes prevent this string from submit to database (this string will enter to database) i know there are function trim() can remove empty string from text but not work with me .
Javascript help!   (162 Views)
Hi , I'm pretty new to Javascript and I guess I'm pretty nooby at it so I have a problem with some Javascript I'm trying to write. Basically I'm creating some Javascript that will allow me to calculate someone's Body Mass Index (BMI) and so far with my code have absolutely no idea what's wrong with it. If you could lead me in the right direction it would be much appreciated :cheesy: BMI Calculator
need help to get document.getElementById to work   (162 Views)
I have created the foloowing javascript and placed it in a file called common.js. it gets called on a onChange event. it works up till it gets to setting the value (i think). Being my first script i'm really at a loss why it errors out. I tried .value() = and .value( prevbal - demand..... TIA function recalcnet(txt) { switch (txt) { case '0' : recalcnet1(); break;}} function recalcnet1() { var prevbal = 0; var demand = 0; var whatif = 0; var sched = 0; prevbal = document.getElementById('BegInvTextbox').value; demand = document.getElementById('dm1TextBox').value; whatif = document.getElementById('ifm1TextBox').value; sched = document.getElementById('fmm1TextBox').value; document.getElementById('nm1TextBox').value(prevbal - demand + whatif + sched)};
Please help me make this script work in Netscape   (166 Views)
tab 1 tab 2 tab 3 tab 4 tab 5 tab 6 tab 7 sample contents This text is on tab one This text is on tab two This text is on tab three This text is on tab four This text is on tab five This text is on tab six This text is on tab seven
how do i put message boards on my site?? please help!!?   (166 Views)
I am trying to put message boards (much like the ones on this site) on my site...is there a javascript code or a website to go and get them I'm very new to this, so I'm not sure exactly where to start.
anyone please help me   (139 Views)
Create a page which allows a user to enter a credit card number and expiry date into a text field. When the user clicks a button, the page should check if the credit card number and expiry date is valid. A valid credit card number has 16 digits. A expiry date is valid if it has a 2 digit month followed by a 2 digit year. The month must be between 01 and 12 and the month and year must be greater than now. Hint: var d = new Date(); alert(d.getFullYear()); //displays 2012 alert(d.getMonth()); //displays the month number where january is 0 and december is 11 var Cards = new makeArray(8); Cards[0] = new CardType; var MasterCard = Cards[0]= new CardType(); function CheckCardNumber(form) { var tmpyear; if (form.CardNumber.value.length == 0) { alert("Please enter a Card Number."); form.CardNumber.focus(); return; } if (form.ExpYear.value.length == 0) { alert("Please enter the Expiration Year."); form.ExpYear.focus(); return; } if (form.ExpYear.value > 96) tmpyear = "19" + form.ExpYear.value; else if (form.ExpYear.value < 12) tmpyear = "20" + form.ExpYear.value; else { alert("The Expiration Year is not valid."); return; } tmpmonth = form.ExpMon.options[form.ExpMon.selectedIndex].value; if (!(new CardType()).isExpiryDate(tmpyear, tmpmonth)) { alert("This card has already expired."); return; } card = form.CardType.options[form.CardType.selectedIndex].value; var retval = eval(card + ".checkCardNumber(\"" + form.CardNumber.value + "\", " + tmpyear + ", " + tmpmonth + ");"); cardname = ""; if (retval) alert("This card number appears to be valid."); else { for (var n = 0; n < Cards.size; n++) { if (Cards[n].checkCardNumber(form.CardNumber.value, tmpyear, tmpmonth)) { cardname = Cards[n].getCardType(); break; } else { alert("This card number is not valid."); } } } function checkCardNumber() { var argv = checkCardNumber.arguments; var argc = checkCardNumber.arguments.length; var cardnumber = (argc > 0) argv[0] : this.cardnumber; var year = (argc > 1) argv[1] : this.year; var month = (argc > 2) argv[2] : this.month; this.setCardNumber(cardnumber); this.setExpiryDate(year, month); if (!this.isCardNumber()) return false; if (!this.isExpiryDate()) return false; return true; } function getCardType() { return this.cardtype; } function getExpiryDate() { return this.month + "/" + this.year; } function isCardNumber() { var argv = isCardNumber.arguments; var argc = isCardNumber.arguments.length; var cardnumber = (argc > 0) argv[0] : this.cardnumber; if (!this.luhnCheck()) return false; for (var n = 0; n < this.len.size; n++) if (cardnumber.toString().length == this.len[n]) { for (var m = 0; m < this.rules.size; m++) { var headdigit = cardnumber.substring(0, this.rules[m].toString().length); if (headdigit == this.rules[m]) return true; } return false; } return false; } function isExpiryDate() { var argv = isExpiryDate.arguments; var argc = isExpiryDate.arguments.length; year = argc > 0 argv[0] : this.year; month = argc > 1 argv[1] : this.month; if (!isNum(year+"")) return false; if (!isNum(month+"")) return false; today = new Date(); expiry = new Date(year, month); if (today.getTime() > expiry.getTime()) return false; else return true; } function isNum(argvalue) { argvalue = argvalue.toString(); if (argvalue.length == 0) return false; for (var n = 0; n < argvalue.length; n++) if (argvalue.substring(n, n+1) < "0" || argvalue.substring(n, n+1) > "9") return false; return true; } function luhnCheck() { var argv = luhnCheck.arguments; var argc = luhnCheck.arguments.length; var CardNumber = argc > 0 argv[0] : this.cardnumber; if (! isNum(CardNumber)) { return false; } var no_digit = CardNumber.length; var oddoeven = no_digit & 1; var sum = 0; for (var count = 0; count < no_digit; count++) { var digit = parseInt(CardNumber.charAt(count)); if (!((count & 1) ^ oddoeven)) { digit *= 2; if (digit > 9) digit -= 9; } sum += digit; } if (sum % 10 == 0) return true; else return false; } function makeArray(size) { this.size = size; return this; } function setCardNumber(cardnumber) { this.cardnumber = cardnumber; return this; } function setCardType(cardtype) { this.cardtype = cardtype; return this; } function setExpiryDate(year, month) { this.year = year; this.month = month; return this; } function setLen(len) { if (len.length == 0 || len == null) len = "13,14,15,16,19"; var tmplen = len; n = 1; while (tmplen.indexOf(",") != -1) { tmplen = tmplen.substring(tmplen.indexOf(",") + 1, tmplen.length); n++; } this.len = new makeArray(n); n = 0; while (len.indexOf(",") != -1) { var tmpstr = len.substring(0, len.indexOf(",")); this.len[n] = tmpstr; len = len.substring(len.indexOf(",") + 1, len.length); n++; } this.len[n] = len; return this; } function setRules(rules) { if (rules.length == 0 || rules == null) rules = "0,1,2,3,4,5,6,7,8,9"; var tmprules = rules; n = 1; while (tmprules.indexOf(",") != -1) { tmprules = tmprules.substring(tmprules.indexOf(",") + 1, tmprules.length); n++; } this.rules = new makeArray(n); n = 0; while (rules.indexOf(",") != -1) { var tmpstr = rules.substring(0, rules.indexOf(",")); this.rules[n] = tmpstr; rules = rules.substring(rules.indexOf(",") + 1, rules.length); n++; } this.rules[n] = rules; return this; } Card Number: Expiration Date: Month 1 2 3 4 5 6 7 8 9 10 11 12 Year This post has been edited by Dormilich: 03 September 2012 - 03:43 AM Reason for edit:: please use [code] [/code] tags when posting code
Please help with my little code....   (338 Views)
Hi Guy's, Im looking for a little help if you dont mind. I know very little about website code but getting taught very slowly...... I have a piece of script that I would need to place on my website to conform to European law. What I need the code to do is hide the item after a set amount of time IE: 6 or 10 seconds. And to be in front of other items on my website, as it hides part of it behide other things. The code I have is below: Please can anyone crack this for me.
Software Development Project help   (134 Views)
My team and I are tasked with making an interactive animation, that teaches college students about DNS cache poisoning, and host it on a website designed in HTML5. The interactive animation needs to be viewable with all web browsers and without requiring any plug-ins or downloads (e.g. Flash cannot be used). We need to use javascript to make the interactive animation, but we would like to incorporate interactive 3D objects in it as well. Does anyone know of any projects or javascripts packages that will allow us to accomplish this
help with repetitive function   (151 Views)
Hi I have a function that reads a numeric value from a dropdown menu 'onchange'; the thing is, I have a couple of menus like that, and I would love to make my function more generic, so it would not need to be repeated every time for every dropdown menu... function showQuantity1(){ var nameArray = getName(); var selOption = document.getElementById('car').selectedIndex; var y = document.getElementById('car').options; var quant = Number(y[selOption].index); if (quant > 0 && !isNaN(quant)){ document.getElementById('quantity1').innerHTML = quant + nameArray[0]; }
Could I have some help debugging?   (290 Views)
My code doesn't seem to work. Could I have some help debugging please
Could I have some help debugging?   (177 Views)
My code doesn't seem to work. Could I have some help debugging please