请问老师留的课后作业有人看可以发一下代码参考一下吗
JS:
function getParam(id) { if (confirm("确定要删除吗?")){ //mainForm为表单名字 mainForm.action = "<%=basePath%>servlet/DeleteOneServlet?id=" + id; mainForm.submit(); } }
JSP:
<a href="javascript:getParam(${message.id})">删除</a>
老哥稳稳的
JS:
<script type="text/javascript">
function deleteOne(basePath,id){
if(confirm("确定要删除吗?"))
{
mainForm.setAttribute("action",basePath+"DeleteOneServlet.action?id="+id);
mainForm.submit();
}
}
</script>
JSP:
<a href="javascript:deleteOne('<%=basePath%>',${message.id})">删除</a>