Explain Java Script Builtin Objects
https://www.computersprofessor.com/2016/06/explain-java-script-builtin-objects.html
|
Most of the objects that you will
use in your script will be prebuilt once. That come with the browser.
The document object.
The window object.
The form object
Browser object
Date object.
The document object:-
A
document is a web page that is being either displayed (or) created. The
document has a no.of properties that can be accessed by java script programs
and used to manipulate the control of the page.
Write, writeln:- Any data (or) html tags can be
rendered within these methods.
Eg:- document. write (“<b> name </b>”);
document. writeln (“<h1 > text </h1>”);
bgcolor, fgcolor:- These properties are responsible
for setting the background color of the page (or) foreground color of the
page elements.
Eg:- document. bgcolor = “red”;
document. fgcolor = “yellow”;
Close( ):- It usually shuts the process of
entering of data on the current page. The document is not completely returned
until the close method has been called.
Eg:- document.
close ( );
The window object:-
The
browser window is a mutable object that can be addressed by a java script
code.
Some
of the methods of window objects.
Open (“URL”,”name”):- This opens a new
window which contains the document specified by “URL”.
Close( ):- This shuts the current window.
tool bar = [0/1]
Location = 0 (or) 1
Directories = 1 (or) 0
Status = 1 (or) 0
Menu bar = 1 (or) 0
Scroll bar = 1 (or) 0
Resizable = 1 (or) 0
Width = pixels
Height = pixels
When
positioning the content, especially on dynamic pages it is useful to be able
to locate it whatever the resolution of the screen or size of the window
being used.
Eg:- new window = open (“newwin”,
status = “o”, width = “ 100”, height = “100”, scroll bar = “1”, tool bar = “1”);
The form object:-
Two
aspects of the form can be manipulated through java script. First – the data
that is entered in to the your form can be checked at submission. Second –
you can built form’s through java script.
onClick = “Method”:- This event is triggered when the user clicks
on that element.
onSubmit = “Method”:- This event is can be triggered by
the form itself and occurs when the form is submitted.
OnRest = “Method”:- This is triggered when a form is
‘reset’ by the user.
The browser object:-
No two
browser models will process your java script in the same way. So you try to
find out which browser is being used to view your web page. The browser is a
java script object for historical reasons the browser object is actually
called the navigator object.
navigator.appCodeName:- It
provides the internal name of the browser.
Eg:- Mozilla
navigator.appName:- It gives the globally recognized
name of the browser. This is the public name of the browser.
Eg:- Internet
explorer.
naivgator. AppVersion:-
It is used to supply the version number, platform on which the browser
is running.
navigator.userAgent:- the strings app code name &
appversion concatenated together.
navigator.pluggins:- An array containing details of all
installed plugging’s.
navigator.mimetypes:- An array of all supported mime
types.
Date object:-
Manipulating date and times is a complicated
business. Like most programming systems java script has two separate
notations of time; UTC and local. (UTC – universal time)
Date( ) Construct an empty date object.
Date(string):- Create a date object based upon the
content’s of a text string.
Date: (year, month, day [hours, minutes,
seconds]):- create a new date object based upon numerical values for the
year, month and day.
getDate( ):- Return the day of the month.
getDay( ):- Return an integer representing the
day of the week. Sunday = is ‘o’ & Saturday is ‘6’.
getFullyear( ):- Return the year as a four digit no.
getHours( ):- Return the hour field of the day
object.
|
