Welcome to the Outputting Text Practice Lab. In this module you will be provided with the instructions and devices needed to develop your hands-on skills.
The following exam objective is covered in this lab:
- 4.3 Complete and debug code that outputs to an HTML document
It will take approximately 10 minutes to complete this lab.
Exercise 1 - Producing Outputs
Generally, when you develop any program, you write code to take the inputs from the user at runtime, process the taken inputs, and produce the outputs. The display of the program outputs is very important to determine the successful execution of the program.
- document.getElementById() method: This method takes the id of the HTML element as its parameter. The element id helps the method to access the HTML element.
- innerHTML property: This property is used with the method document.getElementById(). Using this property, you can pass on the required text, which needs to be displayed, to the HTML element. You can also retrieve and display the values of the variables.
- document.write() method: This method directly writes the text on the HTML pages.
- Task 1 - You will download the Visual Studio Code workspace (Calculator) from the Intranet and create a new HTML page named Outputtext.html in the Calculator workspace.
After completing this exercise, you will be able to:
See the full benefits of our immersive learning experience with interactive courses and guided career paths.