Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/408.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在jsp中单击复选框时创建删除按钮?_Javascript_Html_Jsp - Fatal编程技术网

Javascript 如何在jsp中单击复选框时创建删除按钮?

Javascript 如何在jsp中单击复选框时创建删除按钮?,javascript,html,jsp,Javascript,Html,Jsp,我想在单击复选框时在jsp页面上显示或插入一个按钮。这是我的代码。 这是我的index.jsp页面 有人能帮我吗 JSP页面 函数validateForm() {var validfirstUsername=document.form.text1.value.match(/^[A-Za-z]{3,20}$/); var validage=document.form.text2.value.match(/^[1-9]?[0-9]{1}$| 100/); var validphoneno=doc

我想在单击复选框时在jsp页面上显示或插入一个按钮。这是我的代码。 这是我的index.jsp页面 有人能帮我吗

JSP页面

函数validateForm()
{var validfirstUsername=document.form.text1.value.match(/^[A-Za-z]{3,20}$/);
var validage=document.form.text2.value.match(/^[1-9]?[0-9]{1}$| 100/);
var validphoneno=document.form.text3.value.match(/^\d{10}$/);
if(validfirstUsername==null){
警告(“您的名字无效”);
document.form.text1.value=“”;
返回false;
}
如果(有效期==null){
提醒(“您的年龄无效”);
document.form.text2.value=“”;
返回false;
}
if(validphoneno==null){
提醒(“您的电话号码无效”);
document.form.text3.value=“”;
返回false;
}
}                       
输入学生详细信息。。。。
名称:

年龄:nbsp

性别:男性 女性

电话号码:

日期:
单击复选框时,
checkid
函数处于

$(document).ready(function(){
   $('input[type="checkbox"]').bind('click',function() 
   {
     alert($(this).is(":checked"));
     //Or you could use alert($(this).attr("checked") == "checked");
   });
});

基于选中的write函数

@Sridhar..我想在jspya中使用它,它将在jsp中工作。在head中添加jquery并调用该函数只需将该代码放入jsp中的某个地方,

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
function checkid(id) {
    $('#delete_button').show();
}
</script>
<input type="button" id="delete_button" style="display: none" value="Delete"/>
$(document).ready(function(){
   $('input[type="checkbox"]').bind('click',function() 
   {
     alert($(this).is(":checked"));
     //Or you could use alert($(this).attr("checked") == "checked");
   });
});