<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="book" uri="http://xiao.sms.show.Show"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
.cs1{
display:"none"
}
</style>
<script >
var btn1=document.getElementById("btn1");
var ipts=document.getElementByClassName("cs1");
alter(ipts);
btn1.onclick=function (){
alter("error")
for(var i=0;i<ipts.length;i++){
ipts[i].style.display="display"
}
function check(){
for(var i=0;i<ipts.length;i++){
if(ipts[i].value!==null){
return false;
}
}
return true;
}
</script>
</head>
<body>
<form action="CommunionDB/servlet/Add" onsubmit="return check()">
<table>
<book:oper>g</book:oper>
</table>
<input type="button" name="add" value="add" id="btn1"><br/>
<input type="text" name="bName" class="cs1"><br/>
<input type="text" name="autor"class="cs1"><br/>
<input type="text" name="price" class="cs1"><br/>
<input type="submit" value="make sure to add" class="cs1">
</form>
</body>
</html>
jsp页面中js事件不响应
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- Go 旅城通票 2016-07-23 13:58关注
一堆问题
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<br> .cs1 {<br> display: none;/********/<br> }<br>
<form action="CommunionDB/servlet/Add" onsubmit="return check()"> <table> <book:oper>g</book:oper> </table> <input type="button" name="add" value="add" id="btn1"><br /> <input type="text" name="bName" class="cs1"><br /> <input type="text" name="autor" class="cs1"><br /> <input type="text" name="price" class="cs1"><br /> <input type="submit" value="make sure to add" class="cs1"> </form> <script> //放下面来,要不dom没有生成,要么放到window.onload里面,check不能放里面 var btn1=document.getElementById("btn1"); //var ipts = document.getElementByClassName("cs1"); //========> var ipts = document.getElementsByClassName("cs1"); //alter(ipts); //========> alert(ipts); btn1.onclick = function () { //alter("error") //========> alert("error") for (var i = 0; i < ipts.length; i++) { //ipts[i].style.display = "display" ipts[i].style.display = "inline" } }////////////////////少了 function check() { for (var i = 0; i < ipts.length; i++) { //if (ipts[i].value !== null) { if (ipts[i].value =='') { return false; } } return true; } </script>
解决 无用评论 打赏 举报
悬赏问题
- ¥15 Vue3 大型图片数据拖动排序
- ¥15 划分vlan后不通了
- ¥15 GDI处理通道视频时总是带有白色锯齿
- ¥20 用雷电模拟器安装百达屋apk一直闪退
- ¥15 算能科技20240506咨询(拒绝大模型回答)
- ¥15 自适应 AR 模型 参数估计Matlab程序
- ¥100 角动量包络面如何用MATLAB绘制
- ¥15 merge函数占用内存过大
- ¥15 使用EMD去噪处理RML2016数据集时候的原理
- ¥15 神经网络预测均方误差很小 但是图像上看着差别太大