关于js的跳转问题 <a href="addAction?pid=<s:property value="#product.pid"/>" onclick="isLogon()">加入购物车</a>应该是执行了href里面的内容。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html> <script type="text/javascript"> </script> <body> <input type="button" value="跳转" onclick="window.location.href='http://www.baidu.com'"/> <a onclick="window.location.href='http://www.baidu.com';void 0" href="#"> 点击这里 </a> </body></html> 什么意思?我的意思就是满足js方法中的条件就执行该方法的网页跳转不满足条件就执行a 中 href 兄弟看看试试<a href="javascript:void(0);" onclick="isLogon('addAction?pid=<s:property value="#product.pid"/>')">加入购物车</a><script type="text/javascript">function isLogon(path){var name=document.getElementById("name").value;if(name==null) //即使设为true 还是一样 window.location.href="/jsp/log.jsp";}else{ window.location.href=path;}</script> 已经找到方法了,楼上的方法看上去可行<a href="addAction?pid=<s:property value="#product.pid"/>" onclick="return isLogon()">加入</a><script type="text/javascript"> function isLogon(){ var name=document.getElementById("name").value; if(name==null) {window.location.href="/ShoppingWeb/jsp/log.jsp"; return false;} else {return true;} }</script> 用Fomatter处理带有中文的字符串格式时出现的问题 关于Tomcat 谁用过spring2.0的新技术spring portlet mvc技术吗? 如何在JSP页面中屏蔽掉一些快捷键,例如屏蔽调F5,Ctrl+N等等,请高手指点一二 国内哪些商业的工作流产品比较好? UNXI下的JDK哪里找?! 没接触过框架,请大家指点下应该先学哪些东西? 上面有struts师兄没有,现在有一问题,需要帮助 xml文档有了,weblogic下面怎么用jsp调用?请给一段程序。 问个Jbuilder的问题。 birt 获取 session 里的值 weblogic12c 文件上传request获取不到内容
<script type="text/javascript">
</script>
<body>
<input type="button" value="跳转" onclick="window.location.href='http://www.baidu.com'"/>
<a onclick="window.location.href='http://www.baidu.com';void 0" href="#"> 点击这里 </a>
</body>
</html>
什么意思?
我的意思就是满足js方法中的条件就执行该方法的网页跳转
不满足条件就执行a 中 href
<a href="javascript:void(0);" onclick="isLogon('addAction?pid=<s:property value="#product.pid"/>')">加入购物车</a><script type="text/javascript">
function isLogon(path){
var name=document.getElementById("name").value;
if(name==null) //即使设为true 还是一样
window.location.href="/jsp/log.jsp";
}else{
window.location.href=path;
}
</script>
<a href="addAction?pid=<s:property value="#product.pid"/>" onclick="return isLogon()">加入</a><script type="text/javascript">
function isLogon(){
var name=document.getElementById("name").value;
if(name==null)
{window.location.href="/ShoppingWeb/jsp/log.jsp";
return false;}
else {return true;}
}
</script>