helpless Posted November 21, 2005 Share Posted November 21, 2005 hi!i'm sitting here helpless and my head is gonna exploee soon :)i'm gonna cry soon... stittin here for 6 hours now :)have to create a button, wenn i click on the button it has to show the date and the calendarweek, when i click on that button again it has to disappear againcan someone help me??pleaaaaase, need it as soon as possible, if possible within the next half hourthx a lot Link to comment Share on other sites More sharing options...
real_illusions Posted November 23, 2005 Share Posted November 23, 2005 http://www.javascriptkit.com/script/cutindex1.shtmlis where you'll find some calendar dates and times and such.not sure about the hiding option though.i know this isn't within half hour of your post, but better late than never... Link to comment Share on other sites More sharing options...
Chocolate570 Posted November 23, 2005 Share Posted November 23, 2005 Do this: <head><script type="text/javascript">function hidething(){if(document.getElementById("tst").value==1){document.getElementById("divthing").style.visibility="hidden"document.getElementById("tst").value=0}else{document.getElementById("divthing").style.visibility="visible"document.getElementById("tst").value=1}}</script></head><body><div id="divthing" style="visiblity:hidden;"><script Language="JavaScript"> <!--// Week of the year script - By Ada Shimar (ada@chalktv.com)// Based on code by Duncan Kabinu, Florida Department of Agriculture.// Modified by Italian anonimous on 19.08.2002// Visit JavaScript Kit (http://javascriptkit.com) for this script and 400+ morefunction weekNo() {var totalDays = 0;now = new Date();years=now.getYear();var days = new Array(12); // Array to hold the total days in a monthdays[0] = 31;days[2] = 31;days[3] = 30;days[4] = 31;days[5] = 30;days[6] = 31;days[7] = 31;days[8] = 30;days[9] = 31;days[10] = 30;days[11] = 31; // Check to see if this is a leap yearif (Math.round(now.getYear()/4) == now.getYear()/4) {days[1] = 29}else{days[1] = 28} // If this is January no need for any fancy calculation otherwise figure out the// total number of days to date and then determine what weekif (now.getMonth() == 0) { totalDays = totalDays + now.getDate();}else{var curMonth = now.getMonth();for (var count = 1; count <= curMonth; count++) {totalDays = totalDays + days[count - 1];}totalDays = totalDays + now.getDate();}// Here is the modification: considering when start the 1st week of year.// Originally was only: var week = Math.round(totalDays/7)// Check if browser is "Microsoft Internet Explorer" or not and apply the right varvar agt=navigator.userAgent.toLowerCase();if ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) {var firstday=new Date("01/01/"+String(now.getYear())).getDay();}else {var firstday=new Date("01/01/"+String(1900+now.getYear())).getDay();}var diff=7-firstday+1;var week = Math.round((totalDays+diff-firstday)/7); return week;}document.write("Welcome to <b>week "+weekNo()+"<\/b> of "+years+"!")// --></SCRIPT></div><input type="button" value="Hide/Show" onclick="hidething()"><input type="hidden" value="0" id="tst"></body> Link to comment Share on other sites More sharing options...
helpless Posted December 5, 2005 Author Share Posted December 5, 2005 Do this:<{POST_SNAPBACK}> thx!!! Link to comment Share on other sites More sharing options...
Chocolate570 Posted December 6, 2005 Share Posted December 6, 2005 No problem, any time. Don't hesitate to post if you have any further questions. 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