rowdy0429's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
10 (0.01 per day)
Joined:
13-September 12
Profile Views:
197
Last Active:
User is offline Jan 26 2013 07:42 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   rowdy0429 has not set their status

Posts I've Made

  1. In Topic: No answer displays in my disabled textbox?

    Posted 26 Jan 2013

    
    <input type='text' id='gradePlaceholder' disabled='disabled' style='width:250px; height:15px;' /> <br />
    <input type="button" id="calcAverage" value="Compute Average" onclick='calculateAverage()'/>
    
    
    


    WAIT !!! stop the presses I found it !!!!! Yay !!! thank you that helped out alot.....:D
  2. In Topic: No answer displays in my disabled textbox?

    Posted 26 Jan 2013

    At the risk of really sounding terribly stupid.......how? This is just chapter two so I haven't gotten that far yet.But now it makes sense and for ease of use, the user wouldn't realize they had to click in the box to see the rest of the text.
  3. In Topic: No answer displays in my disabled textbox?

    Posted 26 Jan 2013

    I thought this meant the text box could not be typed in.....

    
    <input type='text' id='gradePlaceholder' disabled='disabled'/> <br />  
    
    


    is that incorrect?
    I took out disabled and tried it and it still says one? How did I disable it? If you cannot tell I am new to Javascript.....extremely new. :)
  4. In Topic: No answer displays in my disabled textbox?

    Posted 26 Jan 2013

    Thanks all that really helped me. I also found i misspelled fourth in my code so i corrected that and then switched it up a bit like you all reccomended.
    var d = parseInt(document.getElementById('fourthNumber').value);
    
    


    I am not sure about the typo on line #08 .............
    function calculateAverage() //this is the code for the calculation function
    
    
    

    so for now I have not changed that line. I thought the function name was supposed to be one line and using camelcase is ok, right? did I miss something? All feedback is very appreciated because I want to learn, and mistakes, I learn from quickly. I now get the program to return information , but if iIput all 100s in as the grades it returns "my grade is: 1". Why?

    And one last question...... What does the (1) do in this line?
    var avg = (sum / 5).toFixed(1);  
    
    



    Here is my code again, and of course THANK you all!!!! Your information has helped me understand what I am doing wrong and how to correct it.

    <script type='text/javascript'>
    function calculateAverage() //this is the code for the calculation function
    {var a = parseInt(document.getElementById('firstNumber').value);
    var b = parseInt(document.getElementById('secondNumber').value);
    var c = parseInt(document.getElementById('thirdNumber').value);
    var d = parseInt(document.getElementById('fourthNumber').value);
    var e = parseInt(document.getElementById('fifthNumber').value); //assigns variables to the five grades
    
    var sum = a+b+c+d+e
    var avg = (sum / 5).toFixed(1);  
    var msg = '';  
    
    if(avg <= 100){ msg = "Excellent! You made an A in the class!"; }  
    if (avg <= 89){ msg = "Good Job!  You made a B in the class!"; }  
    if (avg <= 79){ msg = "Not Bad!  You made a C in the class!"; }  
    if (avg <= 69){ msg = "Do better next time, you made a D."; }  
    if (avg <= 64){ msg = "Oh no....you made an F. Sorry you didn't pass."; }  
    document.getElementById('gradePlaceholder').value = '  Your average grade is: '+avg;  
    alert(msg);  
    }</script> 
    
    </head>
    
    <body>
    
    <p>Please enter your five grades and I will display a message with your average. 
    <br />
    Grade one <input type='text' id='firstNumber' /> <br />
    Grade two <input type='text' id='secondNumber' /> <br />
    Grade three <input type='text' id='thirdNumber' /> <br />
    Grade four <input type='text' id='fourthNumber' /> <br />
    Grade five <input type='text' id='fifthNumber' /> <br />  
    
    <input type='text' id='gradePlaceholder' disabled='disabled'/> <br />
    <input type="button" id="calcAverage" value="Compute Average" onclick='calculateAverage()'/>
    
    
    </p> 
    </body>
    </html>
    
    

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

rowdy0429 hasn't added any friends yet.

Comments

rowdy0429 has no profile comments yet. Why not say hello?