直接上代码
中文乱码问题:
html
location.href = "${pageContext.request.contextPath}/"+url+"?id="+id+"&channel="+channel+"&type="+type+"&name="+encodeURI(encodeURI(name));
java
request.setAttribute("id", request.getParameter("id")); request.setAttribute("channel", request.getParameter("channel")); request.setAttribute("type", request.getParameter("type")); request.setAttribute("name",java.net.URLDecoder.decode(request.getParameter("name"), "utf-8"));
注:name是中文.
返回上一页并刷新
<div onclick="javascript:window.location.href=document.referrer;"> 返回 </div>
注:在于document.referrer
html标题滚动
var title = "<%=homeconfigure.getTitle()%>"; var titAn = function() { var t = title.substring(1,12); $("#title").html(t); //标题长度限制,每次只让它显示12个字符. title = title.substring(1,title.length)+ title.substring(0,1); }; if(title.length<12){ $("#title").html(title); }else{ setInterval(function(){ titAn() },700); }
注:在于使用setInterval事件,利用字符串截取即可。