一个表单两个按钮如何实现跳转两个不同的处理页面
我写的js是这样的
<script type="text/javascript">
function a(s) {
var msg = "您真的确定要修改吗!";
var objURL = "goodschangeDeal.jsp?GID="+s.name.toString();
if (confirm(msg)==true){
location.href =objURL;
}else{
location.href = 'shanpinguanlimulu.jsp';
}
function b(s) {
var msg = "您真的确定要删除吗!";
var objURL = "goodsdeleteDeal.jsp?GID="+s.name.toString();
if (confirm(msg)==true){
location.href =objURL;
}else{
location.href = 'shangpinguanlimulu.jsp';
}
}
</script>
表单是这样的
<input type="button" value="修改" name="<%=GID%>" onclick="a(this)"><input type="button" value="删除" name="<%=GID%>" onclick="b(this)">
可是还是不行。。。 为什么 求大神指点
------解决方案--------------------有什么问题?你描述一你的问题,是不跳转还是参数无法获取??????????
还有怎么能写这样的代码?
if(confirm(msg)==true)......
直接这样if(confirm(msg))直接这样写不就OK了。
------解决方案--------------------
if(t=='update'){
var msg = "您真的确定要修改吗!";
var objURL = "goodschangeDeal.jsp?GID="+s;
if (confirm(msg)){
location.href =objURL;
}else{
location.href = 'shanpinguanlimulu.jsp';
}
}
if(t=='delete'){
var msg = "您真的确定要删除吗!";
var objURL = "goodsdeleteDeal.jsp?GID="+s;
if (confirm(msg)){
location.href =objURL;
}else{
location.href = 'shangpinguanlimulu.jsp';
}
}
<input type="button" value="修改" onclick="a('<%=GID%>','update')">
<input type="button" value="删除" onclick="a('<%=GID%>','delete')">