answersLogoWhite

0

i have tried the following

<script type="text/javascript">

var curtime = new Date(),

curday = curtime.getDate(),

curmonth = curtime.getMonth()+1;

if (currentmonth 14)

window.location = "homevlntns.html";

if (currentmonth 31)

window.location = "homehllwn.html";

if (currentmonth 25)

window.location = "homexmas.html";

else window.location = "error.html";

</script>

but no luck.

User Avatar

Wiki User

11y ago

What else can I help you with?

Continue Learning about Engineering

How to display current date in html using javascript?

You can't do it in HTML, but you can in javascript or PHP, which can be added to an HTML document. Just add the code to where you want it to display the time. &lt;?PHP print(Date("l F d, Y")); ?&gt; &lt;script type="text/javascript"&gt; &lt;!-- document.write(Date()); --&gt; &lt;/script&gt;


Who is the support band for the script?

The support band for The Script can vary depending on the tour and location. For specific tours or concert dates, it's best to check the official website or social media channels of The Script for the most accurate and up-to-date information about opening acts.


What is the date of Maharashtra DEd CET exam?

ded new gr PRE 2006i(4767)/PRA SHI-1 Date-16 DEC 2009


How do you define a constructor function for a Date class that initializes the Date objects?

The following is one possible method. If the input arguments would result in an invalid date (or no arguments are given), then the members are set to an arbitrary default date (in this case 1/1/1980). An alternative method that ensures all dates are valid (non-default) would be to throw an exception from the set() member. If your code is producing invalid date arguments (causing the exception to be thrown) then you really need to fix the code that generates those dates. Note that the static methods, is_valid() and is_leap_year(), can be used to check date arguments without actually constructing a date object. Another alternative would be to set a flag that denotes if the date object is valid or not. However, this is the least intuitive method as the onus is then placed upon the user to always check the flag before using the object. #include&lt;iostream&gt; #include&lt;iomanip&gt; class cdate { unsigned m_day; unsigned m_month; unsigned m_year; public: cdate (unsigned day, unsigned month, unsigned year): m_day(1), m_month(1), m_year(1980) { set (day, month, year); } cdate (const cdate&amp; date): m_day(date.m_day), m_month(date.m_month), m_year(date.m_year) {} cdate&amp; operator= (const cdate&amp; date) { m_day=date.m_day; m_month=date.m_month; m_year=date.m_year; } bool set (unsigned day, unsigned month, unsigned year); static bool is_valid (unsigned day, unsigned month, unsigned year); static bool is_leap_year (unsigned year); unsigned day() const { return m_day; } unsigned month() const { return m_month; } unsigned year() const { return m_year; } }; bool cdate::is_valid (unsigned day, unsigned month, unsigned year) { // handle zeroes if (!day !month !year) return false; // handle invalid month if (month&gt;12) return false; // handle 31 day months if ((month==1 month==3 month==5 month==7 month==8 month==10 month==12) &amp;&amp; day&gt;31) return false; // handle 30 day months if ((month==4 month==6 month==9 month==11) &amp;&amp; day&gt;30) return false; // handle leap years if (month==2) { if (!is_leap_year (year) &amp;&amp; day&gt;28) return false; else if (day&gt;29) return false; } // data ok return true; } bool cdate::is_leap_year(unsigned year) { // common year (not divisible by 4) if (year%4) return false; // leap year (not divisible by 100) else if (year%100) return true; // leap year (divisible by 400) else if (year%400==0) return true; // common year return false; } bool cdate::set (unsigned day, unsigned month, unsigned year) { if (is_valid (day, month, year)) { m_day = day; m_month = month; m_year = year; return true; } // alternatively, throw an exception here return false; } std::ostream&amp; operator&lt;&lt; (std::ostream&amp; os, const cdate&amp; date) { os &lt;&lt; std::setw (2) &lt;&lt; std::setfill('0') &lt;&lt; date.day() &lt;&lt; '/' &lt;&lt; std::setw (2) &lt;&lt; std::setfill('0') &lt;&lt; date.month() &lt;&lt; '/' &lt;&lt; std::setw (4) &lt;&lt; std::setfill('0') &lt;&lt; date.year(); return os; } int main () { // invalid date (was not a leap year) std::cout &lt;&lt; "Input:\t29/02/1900" &lt;&lt; std::endl; cdate d1(29,2,1900); std::cout &lt;&lt; "Output:\t" &lt;&lt; d1 &lt;&lt; std::endl; // valid date (was a leap year) std::cout &lt;&lt; "Input:\t29/02/2000" &lt;&lt; std::endl; cdate d2(29,2,2000); std::cout &lt;&lt; "Output:\t" &lt;&lt; d2 &lt;&lt; std::endl; }


How does Java Script store date in a date object?

JavaScript stores dates in a Date object as the number of milliseconds elapsed since January 1, 1970, 00:00:00 UTC, known as the Unix epoch. This representation allows for easy manipulation and comparison of dates. When you create a Date object, it can be initialized with a specific date and time, and JavaScript provides various methods to retrieve and format this information. Internally, the Date object encapsulates this millisecond value, allowing developers to work with dates efficiently.

Related Questions

If I have a month-to-month apartment and I am moving out halfway through a month will they scale down my rent based on my move out date?

Most landlords won't, and they certainly don't have to.


What is January's secondary birthstone?

Birthstones are based off of the month of birth, not the date of birth; therefore, the birthstone for the month of January is garnet.


What is October's 2 birthstones?

Birthstones are based off of the month of birth, not the date of birth; therefore, the birthstones for the month of Octoberare tourmaline and opal.


What is date today of Punjabi month?

what is date of punjabi month


What is Punjabi month date is today?

what is date of punjabi month


What is the birthstone for October 27th?

Birthstones are based off of the month of birth, not the date of birth; therefore, the birthstones for the month of Octoberare tourmaline and opal.


How do you write month year and date in french?

Month: Mois Year: Ann&eacute;e Date: date


Insert date on a webpage using javascript?

Just use new Date(); to get the current date and then use document.getElementById to insert it on the webpage. &lt;div id="example"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; document.getElementById('example') = new Date(); &lt;/script&gt;


How do you count months: by weeks or by date?

Months are typically counted by date, based on the calendar system. Each month has a specific number of days, and the date is used to determine the passage of time within a month. Weeks are not commonly used to count months, as months do not have a consistent number of weeks.


What are the examples of Java script?

validation of forms, date &amp; time.


How is the date for Ramadan determined each year?

The date for Ramadan is determined each year based on the sighting of the new moon, following the Islamic lunar calendar. This method is used to establish the start of the month of Ramadan, which is the ninth month of the Islamic calendar.


What day is it today or what day is today?

&lt;script&gt; var day; day = new Date(); var milli = day.getTime(); // returns milliseconds that have elapsed since 1/1/70 var year = day.getFullYear(); // returns the Year var month = day.getMonth(); // returns the month (0-11 January = 0) var dayofmonth = day.getDate(); // returns the day of the month var day2 = day.getDay(); // returns the integer day of the week (Sunday = 0) var hour = day.getHours(); // returns the integer hour (0 -&gt; 23) var minute = day.getMinutes(); // returns the Minute (0 - &gt; 59) var second = day.getSeconds(); // returns the Second (0 -&gt; 59) You can write out the date or time using document.write() document.write("The date is " + (month + 1) + "/" + dayofmonth + "/" + year); &lt;/script&gt;