Elegance Entertainment has a website that promotes their annual New Year’s Eve party. This site is required to display the current date and the number of days until New Year’s Eve. The nyeProblem.htm file is missing Javascript. Download the iLab 6 folder with this file in it. You must add this code such that the following will be displayed on Elegance’s Web page: Add the script code that will import the javascript file library.js. Declare the following variables and assign the following values: Today = today’s date ThisDay = the current day ThisMonth = the current month ThisYear = the current year DaysLeft = Return value for NYEDays function in libary.js. Sends Today as argument. MonthTxt array with first location = “” and remaining locations storing months “January”, “February”, and so forth. Display today’s date. Add a decision statement that displays the number of days left to New Year’s Eve or a message that says, “IT’S NEW YEARS EVE!”

In order to fulfill the requirements stated above, you need to add the proper JavaScript code to the nyeproblem.htm file. The code should import the library.js file and declare the required variables with their corresponding values.

To import the library.js file, you need to use the script tag and set the “src” attribute to the path of the library.js file. This will allow you to use the functions defined in library.js within your nyeproblem.htm file.

Next, you need to declare the variables Today, ThisDay, ThisMonth, ThisYear, and DaysLeft. Today should be assigned the current date, ThisDay should be assigned the current day, ThisMonth should be assigned the current month, and ThisYear should be assigned the current year. You can use built-in JavaScript functions to get these values.

To obtain the current date, you can use the new Date() constructor and store it in the Today variable. The date object will automatically hold the current date and time.

To extract the current day, month, and year, you can use the appropriate methods of the date object. For example, you can use the getDate() method to get the current day, the getMonth() method to get the current month (where January is represented by 0, February by 1, and so on), and the getFullYear() method to get the current year. Assign these values to the variables ThisDay, ThisMonth, and ThisYear, respectively.

Next, you need to declare the MonthTxt array. The first location should be an empty string, and the remaining locations should store the names of the months in the correct order. For example, the second location should store “January,” the third location should store “February,” and so on.

To display today’s date, you can use the document.write() function and concatenate the values of ThisDay, MonthTxt[ThisMonth], and ThisYear.

Finally, you need to add a decision statement. This decision statement should check whether the value of DaysLeft, which will be returned by the NYEDays function defined in library.js, is equal to 0. If it is, you should display the message “IT’S NEW YEARS EVE!” using the document.write() function. Otherwise, you should display the number of days left to New Year’s Eve.

By following these steps, you will be able to add the required JavaScript code to the nyeproblem.htm file and fulfill the given requirements.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer