How To Make Java Script

Table of contents:

How To Make Java Script
How To Make Java Script

Video: How To Make Java Script

Video: How To Make Java Script
Video: JavaScript Tutorial for Beginners: Learn JavaScript in 1 Hour 2024, November
Anonim

Modern web design is hard to imagine without scripts. Thanks to the scripting language, it became possible to perform a variety of tasks in the browser, from designing the appearance of the page to checking the information entered by the user. As is the case with other languages, you should start learning java-scriрt with the simplest examples.

How to make java script
How to make java script

Instructions

Step 1

You should be aware that java-script is not part of HTML, it is a language on its own. But it is embedded in the page code or a link to the script file is given in it. In order to learn how to write Java scripts, you need an HTML editor with syntax highlighting. For example, CuteHTML is a small and very handy editor.

Step 2

As a rule, language learning begins with displaying the now classic phrase "Hello, world!" To display this line on the browser screen, open an editor and type the following code after the BODY tag: This line makes it clear to the browser that this is where JavaScript starts.

Step 3

Enter the second line: document.write ("Hello, world!") This line will display the phrase "Hello, world!" In the browser window. Pay attention to the elements of this line: first, an indication is given that the text will be displayed. Then the parameters of the text are specified - in this case, its color. Other parameters may be added, such as font size and type.

Step 4

End with java-script tag: This tag signals the browser that the script has finished. Now that you have entered all the lines in the editor, click the View in browser button in the editor (the magnifying glass icon on the background of the globe). In the default browser window that opens, you will see the result of your first script. Please note that the browser may block its execution, and a corresponding warning will appear. Let the browser run java scripts.

Step 5

You can change the size of the text by inserting after the color ‘RED’, separated by a space, size = 7. Experiment with the font size by changing the numbers. Change the color too - for example, to 'BLUE'.

Step 6

Surely you have seen warning messages appearing on the pages more than once. You can display such a message with a java-script. Enter the code below into the editor. It is very simple, so you can easily figure it out. For a detailed study of java-script, search the internet for related tutorials.

Recommended: