Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Form(beverage store) HELP please

readgellmaeee

Recruit
Basic Member
Messages
6
Reaction score
0
Points
16
hello po patulong naman po ulit, eto po yung code ko kapag po kasa nagcomput NaN po yung lumalabas sa change di ko po makita mali ko eh pakitingan naman po salamat po :), yun na lang po yung kulang


<html>
<head>
<title>Beverage Store</title>
</head>

<script type="text/javascript">



var ans, y;

function items() {
document.getElementById('S').value = '50';
document.getElementById('M').value = '100';
document.getElementById('L').value = '150';
document.getElementById('s').value = '50';
document.getElementById('m').value = '100';
document.getElementById('l').value = '150';
}

function Procced() {

if(document.getElementById("s").checked){
var x = document.getElementById("s").value;
}
else if(document.getElementById("m").checked){
var x = document.getElementById("m").value;
}
else if(document.getElementById("l").checked){
var x = document.getElementById("l").value;
}
y = parseInt(document.getElementById("order").value);
ans = document.getElementById("amount");
ans.value = x * y ;
}

function payment(){
var bayad = parseInt(document.getElementById("payment").value);
ans = parseInt(document.getElementById("amount").value);
var ansD = document.getElementById("change");
ansD.value = bayad - ans;
}

function discount() {
var discS = (20 / 25) * 50;
var discM = (20 / 25) * 100;
var discL = (20 / 25) * 150;
document.getElementById('S').value = discS;
document.getElementById('s').value = discS;

document.getElementById('m').value = discM;
document.getElementById('M').value = discM;

document.getElementById('l').value = discL;
document.getElementById('L').value = discL;
}

</script>

<body>
<table border='1' style="width:100%">

<tr>
<td><center><h1>Bewan Beverage Store</h1></center></td>
</tr>

<tr>
<td><center>Choose Drinks:
<Select onchange="items()">
<option hidden> Choose Item
<option> Ice Tea
<option> Orange Juice
<option> Alcohol Drinks
<option> Softdrinks
</Select>

<br>
<br>

<input id="s" id="radio1" type="radio" name="size" />Small
<input id="S" type="text" name="prize" disabled>
<br>
<input id="m" id="radio2" type="radio" name="size" />Medium
<input id="M" type="text" name="prize" disabled>
<br>
<input id="l" id="radio3" type="radio" name="size"> Large
<input id="L" type="text" name="prize" disabled>

</center>
</td>
</tr>

<tr>

<td><center>No. of Order <br>
<input id="order" type="text"/>
<br>
<input id="discount" type="checkbox" value="Senior" onclick="discount()"> Senior Citizen 20%
<br><br>


<input type="submit" value="Proceed" onclick="Procced()"/>

</center></td>
</tr>

<tr>

<td><center>

Amount Due:<br>
<input id="amount" type="text" disabled />
<br>

Enter Payment:<br>
<input id="payment" onblur="payment()" type="text"/>
<br>

Change Due:<br>
<input id="change" type="text" disabled/>

</center></td>
</tr>

</body>
</html>
 
TS ok naman sakin nag NaN lang sya TS pag di mo lahat nalagayan ung mga fields
 
OK naman TS. Nag NaN lang kapag wlang napiling size ng order (Small, Medium, Large). wala kasing nkadefault na selected.
I-default mo nlng yung small as selected para hindi mag NaN.

<input id="s" id="radio1" type="radio" name="size" checked/>Small
<input id="S" type="text" name="prize" disabled>
<br>
<input id="m" id="radio2" type="radio" name="size" />Medium
<input id="M" type="text" name="prize" disabled>
<br>
<input id="l" id="radio3" type="radio" name="size"> Large
<input id="L" type="text" name="prize" disabled>

hope it helped.
 
Back
Top Bottom