|
Mailing Lists
|
Home /
Groups /
Javascript
HELP!
I Googled the words 'javascript' and 'factorial' and (not surprisingly) gotBilly Cox 05/13/08 01:44 P Actually I did and could not find anything that worked for my particular assignment.Kasey Clark 05/13/08 01:47 P it seems that you're looking for google to provide the exact solutionCharlie Griefer 05/13/08 01:57 P Ya, as a matter of fact I am. I am actually taking my final and my professor sucks and we never learned how to do this. I do not care about learning javascript I just want to pass my final!Kasey Clark 05/13/08 02:02 P Note Cal State San Marcos is a bad school to hire javascript developers.Adam Haskell 05/13/08 02:07 P You may as well be honest enough to pay someone to do it for youJames Holmes 05/13/08 10:36 P Then please let us know where you end up. I would not want to have a developer with that attitude on my staff.Larry Lyons 05/14/08 08:33 A If you intend to do any web development, you should learn Javascript *atBilly Cox 05/14/08 09:25 A I would 2nd that :) I started off in web development thinking to myself; ohBob Imperial 05/14/08 12:35 P I did javascript factorial and clicked I'm feeling lucky...seemed to sendAdam Haskell 05/13/08 02:01 P Here is a high-level view of how I would write this code. This is by noBilly Cox 05/13/08 02:39 P Here is a CFML factorial function I made use of recently. I'll leave itIan Skinner 05/13/08 01:50 P > Here is a CFML factorial function I made use of recently. I'll leave itPeter Boughton 05/13/08 02:14 P Can anyone tell me how to do factorials in javascript? I have to write a javascript program that when the user enters a number, it computes the multiplication of all the numbers between 1 and that number and displays the result to the user (in a text box). My HTML part is done, just not the javascript. (example if the uder enters 5 in the first text box, the program displays 120 in the second text box: 1x2x3x4x5) I Googled the words 'javascript' and 'factorial' and (not surprisingly) got at least 100 satisfactory solutions. It's okay to learn coding practices by example, but at least put *some* effort into it before you ask the list. Can anyone tell me how to do factorials in javascript? I have to write a javascript program that when the user enters a number, it computes the multiplication of all the numbers between 1 and that number and displays the result to the user (in a text box). My HTML part is done, just not the javascript. (example if the uder enters 5 in the first text box, the program displays 120 in the second text box: 1x2x3x4x5) Actually I did and could not find anything that worked for my particular assignment. ----- Excess quoted text cut - see Original Post for more ----- it seems that you're looking for google to provide the exact solution that you're just going to copy/paste and turn in. I think the point behind this being an "assignment" is that you're supposed to learn JavaScript. So while nothing you found worked for your particular assignment, take what you found and try to modify it to do what you need. As you hit issues (and you will, it's part of learning), feel free to ask specific questions here (e.g. this is what i need... this is what i have... this is what it's currently doing... this is what's wrong with what it's currently doing). ----- Excess quoted text cut - see Original Post for more ----- Ya, as a matter of fact I am. I am actually taking my final and my professor sucks and we never learned how to do this. I do not care about learning javascript I just want to pass my final! ----- Excess quoted text cut - see Original Post for more ----- Note Cal State San Marcos is a bad school to hire javascript developers. Thanks for the heads up :) Adam Haskell ----- Excess quoted text cut - see Original Post for more ----- You may as well be honest enough to pay someone to do it for you rather than expecting people to donate their time for free do make up for your lack of ability. > Ya, as a matter of fact I am. I am actually taking my final and my professor sucks and we never learned how to do this. I do not care about learning javascript I just want to pass my final! > > > >it seems that you're looking for google to provide the exact solution > >that you're just going to copy/paste and turn in. -- mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ Then please let us know where you end up. I would not want to have a developer with that attitude on my staff. The point is that there's a reason for learning this stuff, if you cannot see it then its your loss. > Ya, as a matter of fact I am. I am actually taking my final and my > professor sucks and we never learned how to do this. I do not care > about learning javascript I just want to pass my final! If you intend to do any web development, you should learn Javascript *at least* well enough to plug existing javascript code into your code and make it work to your liking. If you don't have an appetite for picking up new skills and technology, you might want to consider a different career field. Ya, as a matter of fact I am. I am actually taking my final and my professor sucks and we never learned how to do this. I do not care about learning javascript I just want to pass my final! ----- Excess quoted text cut - see Original Post for more ----- I would 2nd that :) I started off in web development thinking to myself; oh boy I get to do web design and html and all that stuf LOL. I would have to agree with Billy here, after finding out that in order to be very effective at this I also need to know, javascript,html,xhtml,css,sql,as,xml(in varying degrees) ... And in my particular case ColdFusion as my server side scripting language. Here I am several years later and loving it. I'm a late blooming geek here I'd guess you'd say, so if you're not about wanting to try new things and to problem solve, then maybe you should consider another field. Just my 2 cents Bob ----- Excess quoted text cut - see Original Post for more ----- I did javascript factorial and clicked I'm feeling lucky...seemed to send back a good page: http://www.cis.upenn.edu/~matuszek/cit597-2003/Examples/simple-javascript.html Seems to be exactly what you would want to do??? Adam Haskell ----- Excess quoted text cut - see Original Post for more ----- Here is a high-level view of how I would write this code. This is by no means the only way to accomplish this. 1. Write the factorial code (hint: 'for' loop) to work with a hard-coded number and output the result using a javascript alert 2. Change the hard-coded number a few times and execute the code to verify that the result in the alert is correct 3. Write your form code, being certain to name the input field and the field in which you want the result to display 4. Modify your javascript to retrieve the input value from your form instead of using a hard-coded number and output the result to a javascript alert 5. Decide what event will trigger your javascript code (button onclick, input text onblur or onchange) and modify form code accordingly. (hint: if you go with a button, it should not be a submit button, but just a button with an onclick event) 6. Test code to verify that code is working properly 7. Modify javascript to set output result to text field instead of javascript alert 8. Add some validation to your javascript so that the factorial only runs if a numeric value is received. Actually I did and could not find anything that worked for my particular assignment. ----- Excess quoted text cut - see Original Post for more ----- Here is a CFML factorial function I made use of recently. I'll leave it as a good exercise to port this code to JavaScript. <cffunction name="f" output="no" returntype="numeric"> <cfargument name="integer" required="yes" type="numeric"> <cfset Var TheFactorial = 1> <cfloop condition="arguments.integer GT 0"> <cfset TheFactorial = TheFactorial * arguments.integer> <cfset arguments.integer = arguments.integer - 1> </cfloop> <cfreturn TheFactorial> </cffunction>
|
June 20, 2013
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||