复选框显示隐藏

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@page import="com.paNews.*"%>
<!DOCTYPE html>
<html>
<head>
<title> New Document </title>
</head>

<body>
<input type="checkbox" name="fnt1" id="fnt2" onclick="exe()">复选框
<input type="checkbox" name="ft2" id="ft2" style="display:none">复选框2

<script>
function exe(){
var vals=document.getElementById("fnt2").checked;

if(vals==true){
document.getElementById("ft2").style.display = "block";;
}
if(vals==false){
document.getElementById("ft2").style.display = "none";
}
}
</script>
</body>
</html>

posted @ 2019-12-16 14:45  小程大序的猿  阅读(1876)  评论(0编辑  收藏  举报