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!

Beverage sore payment (FORM) Help plss

readgellmaeee

Recruit
Basic Member
Messages
6
Reaction score
0
Points
16
hi this is my current code po para sa payment ng beverage store ang problema po ay kulang 20%discount ayaw nya po gumana patulong naman po salamat.

//lalagyan lang po ng 20% discount yung sa senior citizen







<html>
<head>
<link rel="stylesheet" href="mainBeverage.css">
<title>Beverage Store</title>
</head>

<script type="text/javascript">
function setText(target) {
var txt = document.getElementById(target);
var temp = txt.value;
var tf = document.getElementById("hidden");
tf.value = temp;
}

function sum() {
var txtFirstNumberValue = document.getElementById('hidden').value;
var txtSecondNumberValue = document.getElementById('order').value;
var result = parseInt(txtFirstNumberValue) * parseInt(txtSecondNumberValue);
if (!isNaN(result)) {
document.getElementById('amount').value = result;
}
}

function sub() {
var txtFirstNumberValue = document.getElementById('amount').value;
var txtSecondNumberValue = document.getElementById('payment').value;
var result = parseInt(txtFirstNumberValue) - parseInt(txtSecondNumberValue);
if (!isNaN(result)) {
document.getElementById('change').value = result;
}
}

</script>

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

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

<tr>
<td><img src="Pictures/nestea1.jpg" id="imagesize"
onmouseover="src='Pictures/nestea2.jpg'"
onmouseout="src='Pictures/nestea1.jpg'"/>

<img src="Pictures/orange1.jpg" id="imagesize"
onmouseover="src='Pictures/orange2.jpg'"
onmouseout="src='Pictures/orange1.jpg'"/>

<img src="Pictures/alcohol1.jpg" id="imagesize"
onmouseover="src='Pictures/alcohol2.jpg'"
onmouseout="src='Pictures/alcohol1.jpg'"/>

<img src="Pictures/drinks1.jpg" id="imagesize"
onmouseover="src='Pictures/drinks2.jpg'"
onmouseout="src='Pictures/drinks1.jpg'"/></td>
</tr>

<tr>
<td><center>Choose Drinks:
<Select size='1' name='choose' required>
<option>
<option> Ice Tea
<option> Orange Juice
<option> Alcohol Drinks
<option> Softdrinks
</Select>

<br>
<br>

<input id="hidden" type="hidden" name="hidden" value="0" disabled>

<input id="radio1" type="radio" name="size" value="50" onClick="setText('radio1');" />Small
<input type="text" name="prize" value="50" disabled>
<br>
<input id="radio2" type="radio" name="size" value="100" onClick="setText('radio2');" />Medium
<input type="text" name="prize" value="100" disabled>
<br>
<input id="radio3" type="radio" name="size" value="150" onClick="setText('radio3');" .> Large
<input type="text" name="prize" value="150" disabled>

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

<tr>

<td><center>No. of Order <br>
<input id="order" type="text" name="order" onkeyup="sum();" required />
<br>
<input id="discount" type="checkbox" name="senior" value="Senior"> Senior Citizen 20%
<br><br>


<input type="submit" value="Proceed!!!">

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

<tr>

<td><center>

Amount Due:<br>
<input id="amount" type="text" name="amount" onkeyup="sum();" disabled />
<br>

Enter Payment:<br>
<input id="payment" type="text" name="payment" onkeyup="sub();" required />
<br>

Change Due:<br>
<input id="change" type="text" name="change" onkeyup="sub();" disabled />

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

</form>
</body>
</html>
 
eto code dagdag mo lng sa sum mo na function. .ang mangyayari jan since gnyan mo siya tintrigger sinundan ko nlng code mo bali ang gawin mo nlng unahin mo nlng lagay sa taas ung pag check kung senior ba siya oh hindi para magtake efect ung computation kasi nag if ako kung nagcheck siya at staka mattriger un. .check mo nlng ahaha.

Code:
function sum() {
	var senior_yes = document.getElementById("discount");

var txtFirstNumberValue = document.getElementById('hidden').value;
var txtSecondNumberValue = document.getElementById('order').value;
var result = parseInt(txtFirstNumberValue) * parseInt(txtSecondNumberValue);
if(senior_yes.checked == true){
		discount = result * 0.20;
	discount = result - discount ;
}else{
	discount = result;
}


if (!isNaN(result)) {
document.getElementById('amount').value = discount;
}
}

function sub() {
var txtFirstNumberValue = document.getElementById('amount').value;
var txtSecondNumberValue = document.getElementById('payment').value;
var result = parseInt(txtFirstNumberValue) - parseInt(txtSecondNumberValue);
if (!isNaN(result)) {
document.getElementById('change').value = result;
}
}
 
Back
Top Bottom