-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRating.js
68 lines (47 loc) · 1.9 KB
/
Rating.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
document.write("<div>" + "<h3>" + "How do you rate our website?" + "</h3>" + "<img src='https://image.shutterstock.com/image-vector/how-do-you-rate-our-260nw-1317876044.jpg' alt='Rating Site'>" + "</div>");
// input user's rate
var rate = parseInt(prompt("How do you rate our website?(please enter your rate From 5 to 1)"));
rateWebsite(rate);
function showStars(rateNum) {
for(var i = 0 ; i < rateNum; i++) {
document.write("<div class='horizantalDiv'>" + "<img src='https://th.bing.com/th/id/OIP.XmO2L6mU5Q1fq1tndO67HgHaHF?w=217&h=208&c=7&o=5&pid=1.7'>" + "</div>");
} // end for
}// end of function
///////////////////////////////////////////////////////////////
// function to get all info from customer
function rateWebsite(rate){
// // show rating image
// document.write("<div>" + "<h3>" + "How do you rate our website?" + "</h3>" + "<img src'https://image.shutterstock.com/image-vector/how-do-you-rate-our-260nw-1317876044.jpg'>" + "</div>");
// // input user's rate
// var rate = parseInt(prompt("How do you rate our website?(please enter your rate From 1 up to 5)"));
if (rate == 5 ){
console.log('Excellent')
document.write ("<h4>" + 'your rate is Excellent ' + "</h4>")
document.writeln
showStars(rate);
}
else if (rate == '4'){
console.log('Good')
document.write ("<h4>" +'Your rate is Good '+ "</h4>")
document.writeln
showStars(rate);
}
else if (rate == '3'){
console.log('Average')
document.write ("<h4>" +'Your rate is Average '+ "</h4>")
document.writeln
showStars(rate);
}
else if (rate == '2'){
console.log('Poor')
document.write ("<h4>" +'Your rate is Poor '+ "</h4>")
document.writeln
showStars(rate);
}
else if (rate == '1'){
console.log('Very Poor')
document.write ("<h4>" +'Your rate is Very Poor '+ "</h4>")
document.writeln
showStars(rate);
}
} // add fun