Java代码
- <%
- java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
- java.util.Date currentTime = new java.util.Date();//得到当前系统时间
- String DateTime = formatter.format(currentTime); //将日期时间格式化
- %>
- ############################################ 我是华丽分割线 ########################################
- <div class="yy_header" sex="<c:if test="${USER.sex==1}">mm</c:if><c:if test="${USER.sex==0}">gg</c:if>" guid="${GUID}" taohua="<c:if test="${USER.level==5 or USER.monthUser}"><fmt:formatDate value="${muDate}" type="both" pattern="yyyy-MM-dd"/></c:if><c:if test="${USER.level!=5 and not USER.monthUser}">false</c:if>" datetime="<%=DateTime%>">
XML/HTML代码
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>无标题文档</title>
- <script type="text/javascript" src="http://static.3snews.net/public/js/jquery-1.5.1.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- var datetime=$(".yy_header").attr("datetime");
- var taohuavip=$(".yy_header").attr("taohuavip");
- var regdatetime=$(".yy_header").attr("regdatetime");
- var datetimedatetimeNN=datetime.replace(/\-/g,"").replace(/\:/g,"");
- var taohuaviptaohuavipNN=taohuavip.replace(/\-/g,"").replace(/\:/g,"");
- var regdatetimeregdatetimeNN=regdatetime.replace(/\-/g,"").replace(/\:/g,"");
- //匹配服务器时间
- var snowdate=datetimeNN.split(" ")[0];
- var snowtime=datetimeNN.split(" ")[1];
- var snowdatesnowdatetime=snowdate+snowtime;
- //匹配桃花VIP时间
- var taohuadate=taohuavipNN.split(" ")[0];
- var taohuatime=taohuavipNN.split(" ")[1];
- var taohuadatetaohuadatetime=taohuadate+taohuatime;
- //匹配用户注册时间
- var regdate=regdatetimeNN.split(" ")[0];
- var regtime=regdatetimeNN.split(" ")[1];
- var regdateregdatetime=regdate+regtime;
- alert(snowdatetime)
- alert(taohuadatetime)
- alert(regdatetime)
- //alert(Thuatime.replace(" ","").replace("-",""));
- //alert(Thuatime.replace(/\ /g,"").replace(/\-/g,"").replace(/\:/g,""))
- //删除第二次出现的test
- var str="testORtest"
- var h=str.replace(/test$/,"hello")
- //alert(h)
- })
- </script>
- </head>
- <body>
- <div class="yy_header" sex="gg" guid="215416540" datetime="2014-11-20 12:52:12" taohuavip="2016-12-01 00:00:00" regdatetime="2013-01-01 15:50"></div>
- </body>
- </html>