JavaScript的并且&&
<html> <head> <meta charset="utf-8"> <title>无标题文档</title> <style type="text/css"> #div1 { width: 300px; height: 80px; border: 1px solid red; } </style> </head> <body> <input type="text" id="put" /> <input type="button" id="put1" value="提交" /> <br> <br> <div id="div1"></div> <script type="text/javascript"> var oput=document.getElementById('put'); var odiv=document.getElementById('div1'); var oput1=document.getElementById('put1'); oput1.onclick=function() { var i=oput.value; if(i>9 && i<100)/*(i>9 && i<100)*/ { odiv.innerHTML='两位数' } else { odiv.innerHTML='不是两位数' } } </script> </body> </html>
欢迎访问每天进步网:https://meitianjinbu.cn/