Question

Use JavaScript to write the code. Create a website that gets the current system date. After...

Use JavaScript to write the code.

Create a website that gets the current system date. After getting the system date,

the variable should be converted to a string and then the parts extracted. You should have
day of week, year, month, day of month. 

Display your results in the body of the website as a paragraph.

You can use fucntions like indexof(), etc. to complete this.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

<html>

<head>

                <title> Date </title>

</head>

<body>

                <p id="date"></p>

                <script>

                                var d = new Date(); //get todays date

                                var arr = d.toString().split(" "); //split it

                                var output = ""; //to store output

                                //get each value and append to output

                                output = output + "Day of the week: "+arr[0] +" </br>";

                                output = output + "Year: "+arr[3] +" </br>";

                                output = output + "Month: "+arr[1] +" </br>";

                                output = output + "Day of the month: "+arr[2] +" </br>";

                                document.getElementById("date").innerHTML = output; //output to div

                </script>

</body>

</html>

OUTPUT:

Day of the week: Thu Year: 2018 Month: Feb Day of the month: 15

Add a comment
Know the answer?
Add Answer to:
Use JavaScript to write the code. Create a website that gets the current system date. After...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In this assignment, you will use your basic JavaScript knowledge to create an interactive component to...

    In this assignment, you will use your basic JavaScript knowledge to create an interactive component to your client’s website. This interactive element should be based on one of your CTAs. What does this mean? Think about one of the things that you want to do to get your visitors engaged with your site. Then create a form that the visitor will fill out and to which you will provide some response. Your form should be specific to your website CTA....

  • Could you please help me write a Javascript code that will show a smiley face picture...

    Could you please help me write a Javascript code that will show a smiley face picture when I click the button. The picture should not display until the button is pressed. Here is my attempt at the code. It does not work. Please keep the code as simple as you can as I am new to coding. Please also use the <div> tag if possible, onclick and use the getElementById. Thank you <html> <body> <img id="exampleImage" src="smileyFace.png" /> <button onclick="pushButton()">Try...

  • Create a class called Date212 to represent a date. It will store the year, month and...

    Create a class called Date212 to represent a date. It will store the year, month and day as integers (not as a String in the form yyyymmdd (such as 20161001 for October 1, 2016), so you will need three private instance variables. Two constructors should be provided, one that takes three integer parameters, and one that takes a String. The constructor with the String parameter and should validate the parameter. As you are reading the dates you should check that...

  • JavaScript - Build with Node.js Follow the instructions bellow for a good rate Create a program...

    JavaScript - Build with Node.js Follow the instructions bellow for a good rate Create a program that will add, remove, get and display all items, stored in JSON file, based on user input (i.e. using yargs). You should choose your own individual purpose - it can be a warehouse, ticketing system, grading book, etc. Make sure you create an appropriate JSON object with real-life parameters - for example for user registration system you should use id, email, and a name....

  • Simple JavaScript and HTML: You'll create a simple word guessing game where the user gets infinite...

    Simple JavaScript and HTML: You'll create a simple word guessing game where the user gets infinite tries to guess the word (like Hangman without the hangman, or like Wheel of Fortune without the wheel and fortune). Create two global arrays: one to hold the letters of the word (e.g. 'F', 'O', 'X'), and one to hold the current guessed letters (e.g. it would start with '_', '_', '_' and end with 'F', 'O', 'X'). Write a function called guessLetter that...

  • Need help with creating this JavaScript file. I'm not sure where or how to begin. 1. You are working solely with the DOM object. Thus, you should be coding primarily in the js file. You must use...

    Need help with creating this JavaScript file. I'm not sure where or how to begin. 1. You are working solely with the DOM object. Thus, you should be coding primarily in the js file. You must use the addEventListener, in addition you may need to use id and class attributes as needed. The .html and .css files have been provided to you. See the .png files for an example of what is expected. 2. Place the javaScript file in its...

  • Design and implement a C++ class called Date that has the following private member variables month...

    Design and implement a C++ class called Date that has the following private member variables month (int) day (nt) . year (int Add the following public member functions to the class. Default Constructor with all default parameters: The constructors should use the values of the month, day, and year arguments passed by the client program to set the month, day, and year member variables. The constructor should check if the values of the parameters are valid (that is day is...

  • Java Email Template Application: Create an application that creates a series of emails as outlined below....

    Java Email Template Application: Create an application that creates a series of emails as outlined below. Create an array of email addresses that include the following data: "   james   ,butler,[email protected]" "Josephine,Darakjy,[email protected]" "ART,VENERE,[email protected]" Store a template for a mass email like this: String template =     "To:      {email}\n" +     "From:    [email protected]\n" +     "Subject: Deals!\n\n" +     "Hi {first_name},\n\n" +     "We've got some great deals for you. Check our website!"; When the application starts, it should read the email...

  • PART B: DATE BOOK A classic computer application is the electronic date book: a list of...

    PART B: DATE BOOK A classic computer application is the electronic date book: a list of daily events stored in a calendar. Write a Java program that can be used as a simple date book. The date book will use a separate array for each month of the year, with one array entry for each day in the month (0 = first day of the month, 1 = second day of the month, etc.). The date book is "simple" because...

  • Code a website you will have multiple inputs on the page (do not use the prompt...

    Code a website you will have multiple inputs on the page (do not use the prompt function): You will need to ask for the following (in this order): Ask for their name. Ask for the Amount of Money to borrow: Ask for the Length of Time (Years) Ask for the Annual Interest Rate Use the either of these formulas for getting the payment: P = ((r/12) * PV) / (1 - (1+(r/12))**-(n*12)); P = ((r/12) * PV) / (1 -...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT