๐Ÿ”’ Closed help javascript

Status
Not open for further replies.

SUNRAI

Eternal Poster
anyone ano po kayang problema sa code ko

<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>

<script type="text/Javascript">



if (grade>=97 && grade <=100){
System.out.println("superior");
}

else if (grade>=88 && grade <= 96){
System.out.println("above average");
}

else if (grade>=75 && grade <=84){
System.out.println("average");
}

else if (grade >=70 && grade <= 74){
System.out.println("conditional failure");
}

else if (grade>=69){
System.out.println("failure") ;
}
</script

</head>
<body>

</body>
</html>
 
Di ako nag cocode sa javascript pero isa sa mga mali mo yung pag display ng text, yung System.out.println() ay para sa languange na Java, magkaiba ang Java sa Javascript.
 
Kuha ko na ganito:

JavaScript:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>
<body>

    <input type="text" id="grades">

    <button onclick="displayGrades()">Display Equivalent</button>
    <h2 id="test"></h2>



    <script>
        function displayGrades() {
            let equivalent;
            let grades = document.getElementById('grades').value;

            if (grades >= 97 && grades <= 100) {
                equivalent = "Superior";
            } else if (grades >= 88 && grades <= 96) {
                equivalent = "Above Average";
            } else if (grades >= 75 && grades <= 84) {
                equivalent = "Average";
            } else if (grades >= 70 && grades <= 74) {
                equivalent = "Conditional Failure";
            } else if (grades <= 69) {
                equivalent = "Failure";
            } else {
                equivalent = "Invalid Input";
            }

            document.getElementById("test").innerHTML = equivalent;

        }
    </script>
    
</body>
</html>

You do not have permission to view the full content of this post. Log in or register now.
 
Nasagot ko nayan post mo kanina ah sa kabilang thread. JavaScript kasi need mo, ang ginamit mo naman ay java, magkaiba yun
 
Status
Not open for further replies.

About this Thread

  • 7
    Replies
  • 317
    Views
  • 5
    Participants
Last reply from:
Kryptonite_Atom

Online now

Members online
956
Guests online
2,974
Total visitors
3,930

Forum statistics

Threads
2,276,136
Posts
28,967,815
Members
1,231,128
Latest member
Dedegodskga
Back
Top