JAVA SCRIPT TUTORIAL

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

It separates HTML and code. It makes HTML and JavaScript easier to read and maintain Cached JavaScript files can speed up page loads.

What are the advantages of external scripts?

1. HTML to define the content of web pages

What is html?

In your browser, you can use the console.log() method to display data.

When do we use console.log()?

The document.write() method should be used only for testing.

When do we use document.write() function?

Using document.write() For testing purposes, it is convenient to use document.write():

When do we use write() function?

The type attribute is not required any more.

is the type attribute required now still?

<p id="demo"></p> <script> document.getElementById("demo").innerHTML = 5 + 6 </script>

a good example of innerHTML property

External scripts cannot contain <script> tags.

do we use script tags in external scripts?

3. JavaScript to program the behavior of web pages

what is javascript

In HTML, JavaScript code must be inserted between <script> and </script> tags.

what tags do we use to insert javascript code in HTML?

External scripts are practical when the same code is used in many different web pages.

when is external JS practical?

Scripts can also be placed in external files.

where else can we put javascript beside putting then on the page?

This can improve page load, because HTML display is not blocked by scripts loading.

why is it good to put JS at the bottom of the body element?

You can place any number of scripts in an HTML document.

How many scripts can be placed in HTML document?

Writing into an alert box, using window.alert(). Writing into the HTML output using document.write(). Writing into an HTML element, using innerHTML. Writing into the browser console, using console.log(). Using window.alert()

How many ways can JavaScript "display" data?

JavaScript Display Possibilities

JavaScript Display Possibilities

The id attribute defines the HTML element. The innerHTML property defines the HTML content:

What does the innerHTML property define?

JavaScript is the default scripting language in HTML.

What is java script regarding HTML?

To use an external script, put the name of the script file in the src (source) attribute of the <script> tag: <script src="myScript.js"></script>

What is the syntax of putting external JS on a page?

Using document.write() after an HTML document is fully loaded, will delete all existing HTML:

What will document.write() function do?

Scripts can be placed in the <body>, or in the <head> section of an HTML page, or in both.

Where can we place a script in an HTML page?

JavaScript can be placed in the <body> and the <head> sections of an HTML page.

Where do we place java script on a page?

<script> alert("ezt most kiiratjuk") </script>

what is an example of using script tag?

2. CSS to specify the layout of web pages

what is css?

JavaScript files have the file extension .js.

What is the file extention of JS?

Keeping all code in one place, is always a good habit.

What is the best way to do when we work with scripts?

<script> console.log(5 + 6) </script>

What is the syntax of console.log() function?

the document.getElementById(id) method.

How can we access an HTML element with JS?

Using innerHTML property

How can we add data into a HTML element?

we used a type attribute in the open tag: <script type="text/javascript">.

How did we insert javascript earlier?

with F12, and select "Console" in the menu.

How do we activate console?

You can use an alert box to display data:

When do we use alert box?


Kaugnay na mga set ng pag-aaral

Hardware and Network Troubleshooting

View Set

UWM Intro to Entrepreneurship Final exam

View Set

BSC 101 Unit 1: What is science and how does it work?

View Set

Organizational Management test 1

View Set

Maternity Ch 19: Nursing Care of the Family During Labor and Birth

View Set

Peds Test #2- Immunization Powerpoint

View Set