Java dynamic page title
I've just been given the task of updating a web page in an enterprise java web app 开发者_开发百科to include the date in the page title.
Currently the web page is a static html file - what do i need to do to get the page title to be the current date in YYYY/MM/DD format? Sorry I have no idea where to start!
<script language="Javascript" type="text/javascript">
alert(document.title);
document.title = (new Date()) + " --- " + document.title;
</script>
You have two options:
- Update the page title with Javascript at the body onload event.
- Become this static HTML file into a JSP dinamic page.
Depending on your requirements, the first option will imply less changes. With the first option, you will take the browser date, with the second, you will use the server system date. This could be important if your application is to be accessed from different time zones.
精彩评论