vytas Posted January 1, 2007 Share Posted January 1, 2007 I whas wondering can u change the title of a document with java script:Like if it is in the morning the title would be Good morning.And if it whas in the afternoon it woudld be like Good day.I whas thinking of a way with javascript and html DOM .?like <html><title> </title><head></head><body><script type="text/javascript">function lol(){if (getHours()<=12){document.getElementByTagName("title").write="Good morning";}else{document.getElementByTagName("title").write="Good day";}document.write (document.title)}</script></body></html> But this script ain't working pls help Link to comment Share on other sites More sharing options...
Webworldx Posted January 1, 2007 Share Posted January 1, 2007 <script type='text/javascript'>var the_hour = new Date().getHours();if(the_hour <= 12){ document.title = 'Good Morning';} else { document.title = 'Good Afternoon / Evening';}</script> Link to comment Share on other sites More sharing options...
vytas Posted January 1, 2007 Author Share Posted January 1, 2007 Thank u the script is working.Thank u for ur help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now