@nextleaf
2018-08-31T02:12:35.000000Z
字数 1394
阅读 758
Java 工作日志
<style type="text/css">div {width: 10%;height: 200px;margin: 16% auto;text-align: center;border-style: dashed;border-color: #1E90FF;border-width: 2px}span {border-style: solid;border-color: #D2691E;border-width: 1px}</style>......<body><script language="JavaScript">function cal(val) {if (val != "=") {document.getElementById("calData").innerText += val;} else {var res = eval(document.getElementById("calData").innerText);document.getElementById("calData").innerText = res;}}</script><div><input type="button" value="1" onclick="cal(this.value);"><input type="button" value="2" onclick="cal(this.value);"><input type="button" value="3" onclick="cal(this.value);"><br><input type="button" value="+" onclick="cal(this.value);"><input type="button" value="-" onclick="cal(this.value);"><input type="button" value="*" onclick="cal(this.value);"><input type="button" value="/" onclick="cal(this.value);"><br><input type="button" value="=" onclick="cal(this.value);"><br><br><span id="calData"></span></div></body>
function regTest1() {var str=document.getElementById("testReg").value;var reg=/^\d{3,5}$/;console.log(reg.test(str)?"ok":"retry");}function regTest() {var str=document.getElementById("testReg").value;var reg=/\d{3,5}/;console.log(reg.test(str)?"ok":"retry");}
<div><input id="testReg"><input type="button" value="验证是否含有连续3-5位数字" onclick="regTest()"><input type="button" value="验证是否s是3-5位数字" onclick="regTest1()"></div>
