<%-- Document : index Created on : 2017-4-29, 8:42:26 Author : MinguVan--%><%@page import="my.servlet.CheckServlet"%><%@page import="my.servlet.CreateServlet"%><%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE html><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>随机数小游戏</title> <script type="text/javascript"> var pathName = document.location.pathname; var index = pathName.substr(1).indexOf("/"); var app = pathName.substr(0, index + 1); var xmlhttp; function load(url, func) { if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = func; xmlhttp.open("GET", url, true); xmlhttp.send(); } function check(number) { load(app + "/checknumber?num=" + number, function () { if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { hintdiv = document.getElementById("hint"); hintcontent = xmlhttp.responseText; hintdiv.innerHTML = hintcontent; } }); } function showup() { if (document.getElementById("show").style.display === "none") { document.getElementById("show").style.display = ""; } } </script> <style> </style> </head> <body> <h1>游戏会随机生成0-9之间的整数,你有三次机会去猜中它!</h1> <form method="get" action="<%=request.getContextPath()%>/my.servlet/CreateServlet" > <table> <tr> <td>当前战绩</td> <td>成功次数:<%=CheckServlet.success%></td> <td>总计:<%=CreateServlet.total%></td> <td><input type="submit" value="开始新数字" onclick="showup()"/></td> </tr> <tr id="show" style="display:none"> <td colspan="2"><input type="text" name="number" id="N" /></td> <td><input type="button" value="猜" onclick="check(N.value)"/></td> <td><div id="hint">还有【3】次机会!</div></td> </tr> </table> </form> </body></html>在点击“开始新数字”时,希望显示出隐藏的部分,但是每次刚显示又隐藏了,怎么解决?
添加回答
举报
0/150
提交
取消