-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci_ce_pur.js
44 lines (44 loc) · 1.41 KB
/
ci_ce_pur.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function add(){
var par = document.getElementById("add");
var con = document.getElementById("uid");
var child = document.createElement("div");
child.innerHTML = con.innerHTML;
par.appendChild(child);
}
function show(str) {
if (str == "") {
document.getElementById("uid_det").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("uid_det").innerHTML = this.responseText;
}
};
xmlhttp.open("GET","fetch.php?q="+str,true);
xmlhttp.send();
}
}
function findTotal(){
var arr = document.getElementsByName('price[]');
var tot=0;
for(var i=0;i<arr.length;i++){
if(parseInt(arr[i].value))
tot += parseInt(arr[i].value);
}
document.getElementById('total').value = tot;
}
function rebate_(){
var total = document.getElementById("total").value;
var rebate = document.getElementById("rebate").value;
var purchase = total - parseInt(rebate);
document.getElementById('purchase').value = purchase;
return ;
}