Jump to content

siby

New Members
  • Posts

    4
  • Joined

  • Last visited

siby's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Oh wow, thank you so much, I can't believe it was that simple! It doesn't give me the correct answer when I type the information in, but I'll try and figure that out. thank you thank you thank you!
  2. Well when I try opening it in a web browser, it doesn't display the pop up's with text boxes which I thought I had gotten it to do. See when you open it in firefox or chrome it's supposed to ask for your year of birth then month then date, but it just opens a page with the code.
  3. I'm sorry, I'm new to this website and I didn't know you couldn't post on others threads. I don't know what the problem is, which is why I can't explain it. I was under the impression you knew a great deal about coding and could help me out by identifying the problem, as I am new to coding and am having trouble. Thanks for your time though.
  4. Hi Jacques1, I have written this code for a biorhythm calculator but I can't figure out why it doesn't work, would you be able to take a look and see if you can find the problem? It would be greatly appreciated, thank you. <html> <head> <script> var months = 'janfebmaraprmayjunjulaugsepoctnovdec'; var PI = 3.14159265358979323846; var msPerDay = 1000*60*60*24; var interllectualCycle = 33; var emotionalCycle = 28; var physicalCycle = 23; var birthYear = parseInt(prompt( 'Enter year of birth as a 4 digit integer' )); var birthMonth = prompt( 'Enter name of month of birth' ); //request month of birth var pos = months.indexOf(birthMonth.substring(0, 3) .toLowerCase() ); var posMonth = pos / 3; //alert( 'Month number: ' + pos ); //convert month to number var numberInString = posMonth; var numberMonth = new Number(numberInString); // alert(numberMonth); var birthDay = parseInt (prompt('Enter day of birth as an integer')); //enters birthdate into string var userBirthday = new Date(birthYear, numberMonth, birthDay); //alert ('' + userBirthday); //date object created for current date var currentDate = new Date(); // alert ('' +currentDate) //creating users age in milliseconds var msSinceBirth = currentDate.getTime()- userBirthday.getTime() ; // alert ('' +msSinceBirth); //creating users age in days var userMsDays = Math.floor(msSinceBirth / msPerDay); //document.write ('' + userMsDays); var bioEnergy = (userMsDays * (2 * PI ) / interllectualCycle); var bioEmot = (userMsDays * (2 * PI) / emotionalCycle); var bioPhy = (userMsDays * (2 * PI) / physicalCycle); //Biorhythm energy levels output document.write('You have been alive' + userMsDays + 'days'); document.write('<h1>"Your biorhythm energy levels are :-"</h1>'); document.write('<ul>'); document.write('<li><font color="green">intellectual:</font></li>' + [Math.sin(bioEnergy).toFixed(1)]); document.write('<li><font color="red">emotional:</font></li>' + '' + [Math.sin(bioEmot).toFixed(1)]); document.write('<li><font color="blue">physical:</font></li>' + [Math.sin(bioPhy).toFixed(1)]); document.write('</ul>'); </script> </head> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.