Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Help me to find the mistakes ??????

    I have this programm, but there are some mistakes and I wanted some help.
    Outcome: Some general information, outlining the daily nutritional requirements for boys and girls.


    <html>
    <head>
    <title>i hope this works</title>
    <style>
    body
    {
    background-color:white;
    }
    p {
    color:black;
    font-family:"neverwinter";
    font-size:20pt;
    font-weight: bolder;
    position:relative;
    left:52px;
    }
    </style>
    <script language="Text/Javascript">
    var gen="null";
    var age="null";
    var both=new Array[4];
    both[0]=1300; // calcium
    both[1]=1500; //sodium low
    both[2]=2300; //sodium high
    both[3]=300; // cholesterol

    var female=new Array[8];
    female[0]="55"; //lowest normal fat
    female[1]="78"; // highest normal fats
    female[2]="22"; // saturated fats
    female[3]="2000"; // calories
    female[4]="46"; // protein
    female[5]="15"; // iron
    female[6]="2333"; // vitamin a
    female[7]="23"; // fibre

    var male=new Array[10];
    male[0]="61"; // lowest total fats
    male[1]="95"; // highest total fats
    male[2]="24"; // lowest saturated fats
    male[3]="27"; // hihgest saturated fats
    male[4]="2200"; // lowest calories
    male[5]="2400"; // highest calories
    male[6]="52"; // protein
    male[7]="11"; // iron
    male[8]="3000"; // vitamin a
    male[9]="32.5"; // fibre

    //no more arrays, new variables to have values assigned to them so they can be calculated later on.
    // these values will contain raw values that will be later assigned in the calculation stage.
    var fats="null"; // normal fats
    var sf="null"; // saturated fats
    var cal="null"; // calories
    var pro="null"; // protein
    var iron="null"; // iron
    var vita="null"; // vitamin A
    var fibre="null"; // fibre
    var sod="null"; // sodium

    function check()
    {
    gender=document.dataform.gender.value;
    age=document.dataform.age.value;
    alert(gender+" "+age);
    }

    function test()
    {
    alert("****");
    }
    </script>
    </head>
    <body>
    <h1 align="center">Application Programming</h1>
    <hr>
    <form name="dataform">
    <table align="center" border="1" cellpadding="1" width="300px">
    <tr>
    <td colspan="2">Please select your age and gender</td>
    </tr>
    <tr>
    <td align="right" width="148px">Age :</td>
    <td align="left"><select name="age">
    <option value="1"> </option>
    <option value="14">14 Years Old</option>
    <option value="15">15 Years Old</option>
    <option value="16">16 Years Old</option>
    <option value="17">17 Years Old</option>
    <option value="18">18 Years Old</option>
    </select>
    </td>
    </tr>
    <tr>
    <td align="right">Gender :</td>
    <td align="left"><select name="gender">
    <option value="2"> </option>
    <option value="0">Female</option>
    <option value="1">Male</option>
    </td>
    </tr>
    <tr>
    <td colspan="2" align="center"><input type="button" value="Maths" onclick=test();></td>
    </tr>
    </table>
    </form>
    </body>
    </html>

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,518
    Thanks
    3
    Thanked 506 Times in 493 Posts
    Code:
    <html>
    <head>
    <title>i hope this works</title>
    <style>
    body
    {
    background-color:white;
    }
    p {
    color:black;
    font-family:"neverwinter";
    font-size:20pt;
    font-weight: bolder;
    position:relative;
    left:52px;
    }
    </style>
    <script type="text/javascript" >
    var gen="null";
    var age="null";
    var both=new Array(4);
    both[0]=1300; // calcium
    both[1]=1500; //sodium low
    both[2]=2300; //sodium high
    both[3]=300; // cholesterol
    
    var female=new Array(8);
    female[0]="55"; //lowest normal fat
    female[1]="78"; // highest normal fats
    female[2]="22"; // saturated fats
    female[3]="2000"; // calories
    female[4]="46"; // protein
    female[5]="15"; // iron
    female[6]="2333"; // vitamin a
    female[7]="23"; // fibre
    
    var male=new Array(10);
    male[0]="61"; // lowest total fats
    male[1]="95"; // highest total fats
    male[2]="24"; // lowest saturated fats
    male[3]="27"; // hihgest saturated fats
    male[4]="2200"; // lowest calories
    male[5]="2400"; // highest calories
    male[6]="52"; // protein
    male[7]="11"; // iron
    male[8]="3000"; // vitamin a
    male[9]="32.5"; // fibre
    
    //no more arrays, new variables to have values assigned to them so they can be calculated later on.
    // these values will contain raw values that will be later assigned in the calculation stage.
    var fats="null"; // normal fats
    var sf="null"; // saturated fats
    var cal="null"; // calories
    var pro="null"; // protein
    var iron="null"; // iron
    var vita="null"; // vitamin A
    var fibre="null"; // fibre
    var sod="null"; // sodium
    
    function check()
    {
    gender=document.dataform.gender.value;
    age=document.dataform.age.value;
    alert(gender+" "+age);
    }
    
    function test()
    {
    alert("****");
    }
    </script>
    </head>
    <body>
    <h1 align="center">Application Programming</h1>
    <hr>
    <form name="dataform">
    <table align="center" border="1" cellpadding="1" width="300px">
    <tr>
    <td colspan="2">Please select your age and gender</td>
    </tr>
    <tr>
    <td align="right" width="148px">Age :</td>
    <td align="left"><select name="age">
    <option value="1"> </option>
    <option value="14">14 Years Old</option>
    <option value="15">15 Years Old</option>
    <option value="16">16 Years Old</option>
    <option value="17">17 Years Old</option>
    <option value="18">18 Years Old</option>
    </select>
    </td>
    </tr>
    <tr>
    <td align="right">Gender :</td>
    <td align="left"><select name="gender">
    <option value="2"> </option>
    <option value="0">Female</option>
    <option value="1">Male</option>
    </td>
    </tr>
    <tr>
    <td colspan="2" align="center"><input type="button" value="Maths" onclick="test();"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • Users who have thanked vwphillips for this post:

    german_89 (10-07-2008)

  • #3
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I tried but again is something wrong with ARRAYS ...........


    Code:
    <html>
    <head>
    <title>Programm</title>
    <style>
    body
    {
    background-color:white;
    }
    p {
    color:black;
    font-family:"neverwinter";
    font-size:20pt;
    font-weight: bolder;
    position:relative;
    left:52px;
    }
    </style>
    <script type="text/javascript" >
    var gen="null";
    var age="null";
    var both=new Array(4);
    both[0]=1300; // calcium
    both[1]=1500; //sodium low
    both[2]=2300; //sodium high
    both[3]=300; // cholesterol
    
    var female=new Array(8);
    female[0]="55"; //lowest normal fat
    female[1]="78"; // highest normal fats
    female[2]="22"; // saturated fats
    female[3]="2000"; // calories
    female[4]="46"; // protein
    female[5]="15"; // iron
    female[6]="2333"; // vitamin a
    female[7]="23"; // fibre
    
    var male=new Array(10);
    male[0]="61"; // lowest total fats
    male[1]="95"; // highest total fats
    male[2]="24"; // lowest saturated fats
    male[3]="27"; // hihgest saturated fats
    male[4]="2200"; // lowest calories
    male[5]="2400"; // highest calories
    male[6]="52"; // protein
    male[7]="11"; // iron
    male[8]="3000"; // vitamin a
    male[9]="32.5"; // fibre
    
    //no more arrays, new variables to have values assigned to them so they can be calculated later on.
    // these values will contain raw values that will be later assigned in the calculation stage.
    var fats="null"; // normal fats
    var sf="null"; // saturated fats
    var cal="null"; // calories
    var pro="null"; // protein
    var iron="null"; // iron
    var vita="null"; // vitamin A
    var fibre="null"; // fibre
    var sod="null"; // sodium
    
    function check()
    {
    gender=document.dataform.gender.value;
    age=document.dataform.age.value;
    alert(gender+" "+age);
    }
    
    function test()
    {
    alert("works");
    }
    </script>
    </head>
    <body>
    <h1 align="center">Application Programming</h1>
    <hr>
    <form name="dataform">
    <table align="center" border="1" cellpadding="1" width="300px">
    <tr>
    <td colspan="2">Please select your age and gender</td>
    </tr>
    <tr>
    <td align="right" width="148px">Age :</td>
    <td align="left"><select name="age">
    <option value="1"> </option>
    <option value="14">14 Years Old</option>
    <option value="15">15 Years Old</option>
    <option value="16">16 Years Old</option>
    <option value="17">17 Years Old</option>
    <option value="18">18 Years Old</option>
    </select>
    </td>
    </tr>
    <tr>
    <td align="right">Gender :</td>
    <td align="left"><select name="gender">
    <option value="2"> </option>
    <option value="0">Female</option>
    <option value="1">Male</option>
    </select>
    </td>
    </tr>
    <tr>
    <td colspan="2" align="center"><input type="button" value="Maths" onclick="test();"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>

  • #4
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,518
    Thanks
    3
    Thanked 506 Times in 493 Posts
    what is wrong with the arrays?

    At the moment you are not using them.
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #5
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Is still not working ............ you can try to run the program, it does not show the message that I want.

    Just try to run it and you will see what is wrong ........

    Anyways Thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •