-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrating.html
111 lines (108 loc) · 3.03 KB
/
rating.html
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html>
<head>
<!-- Font Awesome Icon Library -->
<meta charset="utf-8" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.checked {
color: orange;
margin-top: 25%;
}
</style>
</head>
<body>
<div class="container">
<div class="row justify-content-md-center">
<div class="col-md-6 offset-3">
<span
onmouseover="starmark(this)"
onclick="starmark(this)"
id="1one"
style="font-size: 40px; cursor: pointer"
class="fa fa-star checked"
></span>
<span
onmouseover="starmark(this)"
onclick="starmark(this)"
id="2one"
style="font-size: 40px; cursor: pointer"
class="fa fa-star"
></span>
<span
onmouseover="starmark(this)"
onclick="starmark(this)"
id="3one"
style="font-size: 40px; cursor: pointer"
class="fa fa-star"
></span>
<span
onmouseover="starmark(this)"
onclick="starmark(this)"
id="4one"
style="font-size: 40px; cursor: pointer"
class="fa fa-star"
></span>
<span
onmouseover="starmark(this)"
onclick="starmark(this)"
id="5one"
style="font-size: 40px; cursor: pointer"
class="fa fa-star"
></span>
<br />
<textarea
style="margin-top: 5px"
class="form-control"
rows="5"
id="comment"
placeholder="Enter your review"
></textarea>
<button
onclick="result()"
type="button"
style="margin-top: 10px; margin-left: 5px"
class="btn btn-lg btn-success"
>
Submit
</button>
</div>
</div>
</div>
</body>
<script>
var count;
function starmark(item) {
count = item.id[0];
sessionStorage.starRating = count;
var subid = item.id.substring(1);
for (var i = 0; i < 5; i++) {
if (i < count) {
document.getElementById(i + 1 + subid).style.color = "orange";
} else {
document.getElementById(i + 1 + subid).style.color = "black";
}
}
}
function result() {
//Rating : Count
//Review : Comment(id)
alert(
"Rating : " +
count +
"\nReview : " +
document.getElementById("comment").value
);
}
</script>
</html>