问卷调查 - 在线投票系统
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>问卷调查 - 在线投票系统</title>
<link href="../js/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="../layui/css/layui.css" media="all">
<script src="../layui/layui.js"></script>
<script src="../js/jquery/jQuery-2.2.0.min.js"></script>
<script src="../js/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<script>
$(document).ready(function () {
$.ajax({
url: "/getAllVote",
type: "get",
dataType: "json",
success: function (data) {
// console.log(data);
for (let i = 0; i < data.length; i++) {
let tr = $("<tr align=\"center\" ></tr>");
<pre><code> let td1 = $("<td></td>");
td1.append(data[i].vote_vtitled);
let td2 = $("<td></td>");
td2.html(data[i].vote_vcondition);
let td3 = $("<td></td>");
//layui-icon-praise
var dz = $("<button id=\"dz\" type=\"button\" data-toggle=\"modal\" data-target=\"#myModal1\" class=\"layui-btn layui-btn-warm layui-icon layui-icon-praise \"></button>")
var dwz = $("<button id=\"dwz\" type=\"button\" data-toggle=\"modal\" data-target=\"#myModal1\" class=\"layui-btn layui-icon layui-icon-praise \"></button>")
var ck = $("<button type=\"button\" id='ck' data-toggle=\"modal\" data-target=\"#myModal1\" class=\"layui-btn layui-btn-warm layui-icon layui-icon-face-smile \"></button>");
dz.click(function () {
$("#tm").val(data[i].vote_vtitled);
vote_vid = data[i].vote_vid;
console.log(vote_vid)
});
if (data[i].vote_vcondition === "已结束") {
td3.append(dz)
} else {
td3.append(ck)
}
dwz.click(function () {
alert("此问卷已投票,不能再投票!!!")
})
tr.append(td1);
tr.append(td2);
tr.append(td3);
$("#table").append(tr);
}
}
})
$("#tjwt").click(function () {
let vote_vid = 0;
let subject_stype = $("#th").val();
let subject_scontent = $("#tmmc").val();
$.ajax({
url: "/getSubject",
type: "get",
dataType: "json",
data: {
vote_vid: vote_vid
},
success: function (data) {
for (let i = 0; i < data.length; i++) {
subject_stype = data[i].subject_stype
subject_scontent = data[i].subject_scontent
}
}
});
});
})
</code></pre>
</script>
<div class="layui-table">
<table id="table" class="layui-table " align="center">
<thead>
<tr align="center">
<td>问卷标题</td>
<td>问卷状态</td>
<td>操作</td>
</tr>
</thead>
</table>
</div>
<div class="modal fade " id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" style="width: 800px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h2 class="modal-title" id="myModalLabel1" style="color:red">为【<input type="text" id="tm"
style="border: none;"
disabled="disabled">】统计结果
</h2>
</div>
<div class="modal-body">
<h3>
<table id="tab">
<tr style='display: block'>
<td>
【<input type="text" class="th" style="border: none;width: 50px; color: #00a2d4"
disabled="disabled">】
<input type="text" class="tmmc" style="border: none;" disabled="disabled">
</td>
</tr>
<pre><code> </table>
</h3>
<!--<h3>
【<input type="text" id="th" style="border: none;width: 50px; color: #00a2d4" value="单选" disabled="disabled">】
<input type="text" id="tmmc" value="提提提提提题目" style="border: none;" disabled="disabled"><br><br>
<input type="radio" name="ra"><input type="text"><br><br>
<input type="radio" name="ra"><input type="text"><br><br>
【<input type="text" style="border: none;width: 50px; color: #00a2d4" value="多选" disabled="disabled">】
<input type="text" value="提提提提提题目" style="border: none;" disabled="disabled"><br><br>
<input type="checkbox" name="ch"><input type="text"><br>
<input type="checkbox" name="ch"><input type="text">
</h3><br><br><br>-->
<br><br><br>
<button id="tjwt" type="button" class="layui-btn layui-btn-warm ">提交</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</code></pre>
</div>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/pXUh 著作权归作者所有。请勿转载和采集!