❓ Help Pahelp naman html css js

Status
Not open for further replies.

Falln

Forum Veteran
Hindi pa totally gumagana at maayos yung codes pwede po pahelp ma fix to? Sa mga master jan baka pwede po patulong please.
1. Problem is sa grade calcu and temp converter hindi pa totally nag function dahil may mali pa. Grade calcu sa pag compute. Temp conv pag same unit cinonvert error nalabas is "no selected unit".
 
1. State your problem/objective
2. What's the error code.
3. Give us a snippet of code
4 (optional) Provide a screenshot

Next time construct your thread meaningfully, don't let us guess what's this thread is all about.
 
[CODE lang="html" title="grade calc"]<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="https://fonts.googleapis.com/css?family=Righteous&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css">
<style>

body {
background-image: url("Act3/img/grades.jpg");
background-position: center;
height: 500px;
font-size: 12px;
}

body, button, input {
font-family: 'Righteous', cursive;
font-weight: 700;
letter-spacing: 1.4px;
}

.background {
display: flex;
min-height: 100vh;
}

.container {
flex: 0 1 700px;
margin: auto;
padding: 10px;
}

.screen {
position: relative;
background: #3e3e3e;
border-radius: 15px;
}

.screen:after {
content: '';
display: block;
position: absolute;
top: 0;
left: 20px;
right: 20px;
bottom: 0;
border-radius: 15px;
box-shadow: 0 20px 40px rgba(0, 0, 0, .4);
z-index: -1;
}

.screen-body {
display: flex;
}

.screen-body-item {
flex: 1;
padding: 50px;
}

.screen-body-item.left {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;

}

.app-title {
display: flex;
/flex-direction: column;/
justify-content: center;
align-items: center;
color: #33d9b2;f;
font-size: 26px;
text-transform: uppercase;
border-left: 4px solid #218c74;
padding: 10px;
}

.app-form-group {
margin-bottom: 15px;
}

.app-form-group.buttons {
margin-bottom: 0;
text-align: right;
}

.app-form-control {
width: 100%;
padding: 10px 0;
background: none;
border: none;
border-bottom: 1px solid #666;
color: #ddd;
font-size: 14px;
text-transform: uppercase;
outline: none;
transition: border-color .2s;
}

.app-form-control::placeholder {
color: #FFF;
}

.app-form-control:focus {
border-bottom-color: #ddd;
}

.app-form-button {
background: none;
border: none;
color: #33d9b2;
font-size: 14px;
cursor: pointer;
outline: none;
text-transform: uppercase;
}

.app-form-button:hover {
color: #218c74;
}

.showdata{
text-align: center;
color: white;
font-size: 1.2rem;
padding-top: -10px;
padding-bottom: 10px;
}

</style>
</head>
<body>

<div class="background">
<div class="container">
<div class="screen">
<div class="screen-body">
<div class="screen-body-item left">
<div class="app-title">
<div class="animated infinite heartBeat">
Student <br> Grade <br>
</div>
</div>
</div>
<div class="screen-body-item">
<div class="app-form">
<div class="app-form-group">
<input type="text" class="app-form-control" placeholder="Activities" id="g">
</div>
<div class="app-form-group">
<input type="text" class="app-form-control" placeholder="exam" id="e">
</div>
<div class="app-form-group">
<input type="text" class="app-form-control" placeholder="recitation" id="r">
</div>
<div >
<input type="button" name="" value="Compute" class="app-form-button" onclick="getResult()">
</div>
<div >
<input type="reset" name="" value="reset" class="app-form-button">
</div>
</div>
</div>
<div class="app-form-group showdata">
<p id="result"></p>

</div>
</div>

<script>

function getResult()
{
g = document.getElementById("Activities").value;
e = document.getElementById("exam").value;
r = document.getElementById("recitation").value;
if(g>95 || g<65 || e>95 || e<65 || r>95 || r<65)
{
alert("Grade cannot be greater than 95 and less than 65")
}
else
{
g1 = 0.35*g
g2 = 0.40*e
g3 = 0.25*r
grade = g1+g2+g3
if(grade >=91 && grade <=95)
{
document.getElementById("result").innerHTML = "EXCELLENT";
}
else if(grade >=86 && grade <=90)
{
document.getElementById("result").innerHTML = "GOOD";
}
else if(grade >=80 && grade <=85)
{
document.getElementById("result").innerHTML = "FAIR";
}
else if(grade >75 && grade <=79)
{
document.getElementById("result").innerHTML = "POOR";
}
else if(grade <=74)
{
document.getElementById("result").innerHTML = "FAIL";
}


</script>

</body>
</html>[/CODE]
 

Attachments

  • Screenshot (130).webp
    Screenshot (130).webp
    29.2 KB · Views: 20
Mali document.getElementById mo.

HTML:
<input type="text" class="app-form-control" placeholder="Activities" id="g">

<input  type="text"  class="app-form-control"   placeholder="exam" id="e">

<input  type="text"  class="app-form-control"   placeholder="recitation" id="r">

pero dito (Activities, Exam, Recitation) :

JavaScript:
g = document.getElementById("Activities").value;
 e = document.getElementById("exam").value;
 r = document.getElementById("recitation").value;
 
[XX='Impostor Syndrome, c: 1175218, m: 299786'][/XX]
Sir di ko po gets alin babaguhin dun sa html parehas lang naman po sinend mo sa code ko.

Yung sa JavaScript naman po is gagawin kong isa lang ung document.getElementbyId ganto ba?
document.getElementbyId("Activities, Exam, Recitation").value;
 
[XX='boszken, c: 1175522, m: 486612'][/XX]
check your id references magkaiba.
sa html mo ang linagay mo sa id ng inputs mo ('g', 'e', 'r')
pero sa js mo ang linagay mo ('Activities', 'exam', 'recitation)

it should be this way;
g = document.getElementById("g").value;
e = document.getElementById("e").value;
r = document.getElementById("r").value;
 
Hindi parin po nag cocompute. Pag pinindot compute wala response
 

Attachments

  • IMG20210507211413.webp
    IMG20210507211413.webp
    335.9 KB · Views: 21
Lods. Simple lang yung error mo. Nageend of line siya sabi ni console. Bale kulang ka ng dalawang end brackets sa dulo ng code.

Check mo muna yung console sa susunod. Bestfriend mo yan lalo na kung may js code ka.
 

Attachments

  • Screenshot_2021-05-08-09-35-18-80.webp
    Screenshot_2021-05-08-09-35-18-80.webp
    47.8 KB · Views: 19
Status
Not open for further replies.

About this Thread

  • 10
    Replies
  • 350
    Views
  • 4
    Participants
Last reply from:
Tether

Online now

Members online
408
Guests online
897
Total visitors
1,305

Forum statistics

Threads
2,275,079
Posts
28,960,506
Members
1,233,574
Latest member
Toktokpaff
Back
Top