标签:paper auto java 简单实现 自动 tle script too 文件
脚本部分:
<script type="text/javascript">
$(function () {
setInterval(function () {
$("#autore").load(location.href + " #autore");//注意后面DIV的ID前面的空格,很重要!没有空格的话,会出双眼皮!(也可以使用类名)
}, 8000);//8秒自动刷新
})
</script>
刷新DIV部分:
<div id="autore">
<div id="hr_left">
<span>成绩列表</span>
<table class="hr_table">
<tr>
<th style="width: 70px;">试卷编号</th>
<th style="width: 100px;">试卷文件</th>
<th style="width: 70px;">平均得分</th>
<th>评委评分</th>
</tr>
<?php
$result = mysqli_query($conn, "select * from papers");
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo "<tr><td>" . $row["p_num"] . "</td><td>" . $row["p_name"] . "</td><td>" . $row["p_average_score"] . "</td><td>";
if ($row["p_judge"] != " ") echo $row["p_judge"];
else echo "暂无评分";
echo "</td></tr>";
}
}
?>
</table>
</div>
</div>
唯一需要注意的地方就是,DIV的ID不要出错,用类名的话,只需都换成类名即可。特别是脚本里的第二个地方,必须要有一个空格,你也可以不加空格测试看看。
刷新时间是毫秒单位。
指定DIV局部刷新的简单实现,很简单,但是网上搜到的大部分都很复杂
标签:paper auto java 简单实现 自动 tle script too 文件
原文地址:https://www.cnblogs.com/apolloren/p/9132378.html