<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>可编辑表格</title>
<style>
table {
width: 500px;
border: 1px;
}
td {
background-color: pink;
}
th {
background-color: rgb(0, 162, 255);
}
</style>
</head>
<script></script>
<body>
<table align="center">
<tr>
<th width="100px">学号</th>
<th width="100px">姓名</th>
<th width="100px">年龄</th>
</tr>
<tr>
<td contenteditable="true" id="te">0001</td>
<td>小明</td>
<td contenteditable="true">19</td>
</tr>
<tr>
<td contenteditable="true" id="te">0002</td>
<td>张三</td>
<td contenteditable="true" id="te">18 </td>
</tr>
<tr>
<td contenteditable="true">0003</td>
<td>李四</td>
<td contenteditable="true">22</td>
</tr>
<tr>
<td contenteditable="true">0004</td>
<td>王二</td>
<td contenteditable="true">20</td>
</tr>
if(condition.length<4){}
</table>
</body>
</html>
怎样实现学号输入长度不正确提示呀
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- 你好!机器人 2022-03-15 10:45关注
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>可编辑表格</title> <style> table { width: 500px; border: 1px; } td { background-color: pink; } th { background-color: rgb(0, 162, 255); } </style> </head> <script></script> <body> <table align="center"> <tr> <th width="100px">学号</th> <th width="100px">姓名</th> <th width="100px">年龄</th> </tr> <tr> <td contenteditable="true" onblur="changeNum(1)" id="te1">0001</td> <td>小明</td> <td contenteditable="true">19</td> </tr> <tr> <td contenteditable="true" id="te">0002</td> <td>张三</td> <td contenteditable="true" id="te">18 </td> </tr> <tr> <td contenteditable="true">0003</td> <td>李四</td> <td contenteditable="true">22</td> </tr> <tr> <td contenteditable="true">0004</td> <td>王二</td> <td contenteditable="true">20</td> </tr> </table> <script> function changeNum(e){ var domValue = document.getElementById('te1').innerHTML if (domValue.length<4){ alert('学号长度不能小于4位') } } </script> </body> </html>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
悬赏问题
- ¥100 set_link_state
- ¥15 虚幻5 UE美术毛发渲染
- ¥15 CVRP 图论 物流运输优化
- ¥15 Tableau online 嵌入ppt失败
- ¥100 支付宝网页转账系统不识别账号
- ¥15 基于单片机的靶位控制系统
- ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
- ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
- ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
- ¥15 手机接入宽带网线,如何释放宽带全部速度