lundi 18 mai 2015

JavaScript "if" statement wont run

(Using Javascript) If I enter text in the textbox or not, the alert will not come up. I know this is a simple fix but I can not figure it out! (This is for learning purposes.)

Workout Log Test

<script type="text/javascript">

function myResults() {
    myExercise();
    myWeight();
    mySets();
    myReps();
    myFunction();
}

function myExercise() {
        var txtExercise = document.getElementById("txtExercise");
        var txtOutput = document.getElementById("txtOutput1");
        var name = txtExercise.value;
        txtOutput1.value = "You destroyed, " + name + "!"

        if (txtExercise.length === 0) {
            alert ('Do you even lift?');
            return;

Aucun commentaire:

Enregistrer un commentaire