Szkolenia informatyczne: biuro, technologie internetowe, egzaminy technik
CENA - OFERTA: Jesteś zainteresowany/na kursem – zapraszam do kontaktu ze mną, szczegóły: www.poswojsku.pl .
JavaScript Environment BOM object model browser free training
JAVASCRIPT OBJECT PROGRAMMING LANGUAGE
Second part of the JavaScript training:
JavaScript Environment BOM object model browser free training
Welcome to the training: JavaScript object-oriented programming language
JavaScript Environment BOM object model browser free training
JavaScript is a language that must work in a particular environment, usually the environment for JavaScript is a web browser. Of course, the browser is not the only JavaScript environment. It can be e.g. node.js technology. But I'll tell you a little later.
The JavaScript philosophy on the internet is based on two models:
BOM (Browser Object Model) - for JavaScript
Browser Object Model - supports the behavior of external devices for the browser and the parent object for the browser JavaScript, i.e. the window object.
DOM (Document Object Model) - Document Object Model - for JavaScript
DOM is a standard managed and developed by the World Wide Web Consortium (W3C). It has several levels (0-3), which are implemented to different degrees by browsers.
In this part of the JavaScript training you will find information about the BOM, in the next - the DOM.
BOM Browser Object Model - The most important elements
Window - a JavaScript global object, all built-in JavaScript functions are methods of the window object.
Time for details - JavaScript BOM object
BOM - properties, methods:
NAVIGATOR - GOOD JavaScript
window.navigator - an object that provides knowledge about the browser and its capabilities
window.navigator.userAgent - identifies the browser
SCREEN - JavaScript BOM
The screen property contains information about the monitor settings, e.g. due to the property:
screen.colorDepth - you can read the color depth of the monitor
screen.width - you can read the width of the monitor
screen. .height - you can read the height of the monitor
screen.availWidth - you will read the available monitor width
screen.availHeight - you will read the available height of the monitor
HISTORY - JavaScript BOM
The window.history property gives developers access to pages previously visited within the same browser session. I would add that this access is somewhat limited. You can "travel" through your user history through methods:
history.forward () - forward
history.back () - backwards
history.go (0) - reloading current page:
history.go (-1) - one page back
history.go (11) - eleven pages ahead
LOCATION - JavaScript BOM
window.location - contains a JavaScript object that stores information about the URL address of the currently loaded page
window.location.hostname - contains a JavaScript object that stores information about the domain itself
window.location.href - contains a JavaScript object that stores information about the full website address
FRAMES - GOOD JavaScript
The window.frames property stores the set of frames from the current page, both regular and floating iframes. The window.frames property is always defined and indicates window.
window.frames = = = window - gives console.log - true
WINDOW - main object - JavaScript for browsers
Now it's time for important methods of the window object.
window.open () - JavaScript that allows opening new browser windows, so-called pop-up windows
the window.open method needs (gets) elements:
var poswojsku = window.open ('web address', 'name of the new window', 'window width, window height, status - i.e. info whether the status bar should be displayed');
var poswojsku = window.open (' https://poswojsku.info ', 'education from poswojsku.info', 'width = 500, height = 500, resizable = yes');
window.close () - JavaScript closes a new window
window.moveTo (x, y) - JavaScript moves the browser window to position x, y
window.moveBy (x, y) - JavaScript moves the browser window to x, y
window.resizeTo (x, y) - JavaScript resizes the window by the parameters x, y
window.alert () - JavaScript opens a window with an alert - information for the user
window.prompt () - JavaScript opens a window with a field for entering text - gets text from the user
window.confirm () - JavaScript opens a window with the option for the user to choose between OK and Cancel
window.setTimeout () - JavaScript sets a function delay, example:
function watch out () {alert ('watch out for elephants?');}
setTimeout(uwazaj, 2000);
JavaScript - the above code will display 'watch out for elephants?' 2000 milliseconds delay (2 seconds)
how to not display?
var stop = setTimeout(uwazaj, 2000);
clearTimeout(stop);
window.setInterval () - sets the interval, causes repeated code calls from time to time
now we call the function watch out () so that it is run every three seconds until the call plan is canceled with clearInterval (stop).
var id = setInterval (uwazaj, 2000);
And now you are guaranteed to piss off your site visitors.
HTML DOM Document Object Model - the most important elements
Thank you along with JavaScript for your attention
I invite you to the next part of the training:
JavaScript object oriented programming language
See in the menu similar articles to: JavaScript object-oriented programming language