Objekty

JavaScript pozna nasledovne objekty:
  • anchor
  • button
  • checkbox
  • Date
  • document
  • form lihidden
  • history
  • link
  • location
  • Math
  • navigator
  • password
  • radio
  • reset
  • select
  • string
  • submit
  • text
  • textarea
  • window

  • anchor

    Cast textu, ktora tvori hypertextovy link.
    Syntax:
    <a [href=locationOrURL]
       [name="anchorName"]
       [target="windowName"]>
       [anchorText]
    </a>
    
    Vlastnosti: Ziadne.
    Metody: Ziadne.
    Osetrenie udalosti: Ziadne.


    button

    Tlacitko v html forme.
    Syntax:
    <input
       type="button"
       [name="buttonName"]
       value="buttonText"
       [onClick="handlerText"]>
    
    Vlastnosti:
  • name
  • value
    Metody:
  • click
    Osetrenie udalosti:
  • onClick


    checkbox

    Ide o checkbox z html formy. Je to prepinac umoznujuci pouzivatelovi nastavit jednu z dvoch moznych hodnot (on, off). Syntax:
    <input
       type="checkbox"
       [name="checkboxName"]
       value="checkboxValue"
       [checked]
       [onClick="handlerText"]>
       textToDisplay
    
    Vlastnosti:
  • checked
  • defaultChecked
  • name
  • value
    Metody:
  • click
    Osetrenie udalosti:
  • onClick



    Date

    Umoznuje pracovat s datumom a casom.
    Syntax: Vytvorenie noveho objektu:
    1. dateObjectName = new Date()
    2. dateObjectName = new Date("month day, year hours:minutes:seconds")
    3. dateObjectName = new Date(year, month, day)
    4. dateObjectName = new Date(year, month, day, hours, minutes, seconds)
    
    Vlastnosti: Ziadne.
    Metody:
  • getDate
  • getDay
  • getHours
  • getMinutes
  • getMonth
  • getSeconds
  • getTime
  • getTimeZoneoffset
  • getYear
  • parse
  • setDate
  • setHours
  • setMinutes
  • setMonth
  • setSeconds
  • setTime
  • setYear
  • toGMTString
  • toLocaleString
  • UTC
    Osetrenie udalosti: Ziadne.


    document

    Obsahuje informacie o aktualnom dokumente a metody umoznujuce zapis do vysledneho dokumentu.
    Syntax:
    <body
       [background="backgroundImage"]
       [bgcolor="backgroundColor"]
       [text="foregroundColor"]
       [link="unfollowedLinkColor"]
       [alink="activatedLinkColor"]
       [vlink="followedLinkColor"]
       [onLoad="handlerText"]
       [onUnload="handlerText"]>
    </body>
    
    Vlastnosti:
  • alinkColor
  • anchors
  • bgColor
  • cookie
  • fgColor
  • forms
  • lastModified
  • linkColor
  • links
  • location
  • referrer
  • title
  • vlinkColor
    Metody
  • clear
  • close
  • open
  • write
  • writeln
    Osetrenie udalosti: Ziadne.


    form

    Umoznuje pouzivatelovi vkladat text do dokumentu, prip. poslat ho serveru, a tiez vykonat volbu pomocou inych objektov (checkbox, radio button, selection list).
    Syntax

    To define a form, use standard html syntax with the addition of the onSubmit event handler:

    <form
       [name="formName"]
       [target="windowName"]
       action="serverURL"
       method=get | post
       [enctype="encodingType"]
       [onSubmit="handlerText"]>
    </form>
    
    Vlastnosti:
  • action
  • elements
  • encoding
  • length
  • method
  • target
    Metody:
  • submit
    Osetrenie udalosti:
  • onSubmit


    history

    Obsahuje informacie o URL, ktore klient navstivil v danom okne. Informacia je dosiahnutelna aj cez menu Navigatora.
    Syntax:
    1. history.propertyName
    2. history.methodName(parameters)
    
    Vlastnosti:
  • length
    Metody
  • back
  • forward
  • go
    Osetrenie udalosti: Ziadne.


    link

    Cast textu alebo obrazok po kliknuti na ktory sa do cieloveho okna nahra hypertextova referencia daneho linku, teda novy html dokument.
    Syntax:
    <a href=locationOrURL
       [NAME="anchorName"]
       [TARGET="windowName"]
       [onClick="handlerText"]
       [onMouseOver="handlerText"]>
       linkText
    </a>
    
    Vlastnosti:
  • hash
  • host
  • hostname
  • href
  • pathname
  • port
  • protocol
  • search
  • target
    Metody Ziadne.
    Osetrenie udalosti:
  • onClick
  • onMouseOver


    location

    Obsahuje informaciu o momentalnom URL.
    Syntax:
    [windowReference.]location.propertyName
    
    Vlastnosti:
  • hash
  • host
  • hostname
  • href
  • pathname
  • port
  • protocol
  • search
  • target
    Metody Ziadne.
    Osetrenie udalosti: Ziadne.


    Math

    Obsahuje vlastnosti a metody pre pracu s matematickymi konstantami a funkciami.
    Syntax:
    1. Math.propertyName
    2. Math.methodName(parameters)
    
    Vlastnosti:
  • E
  • LN2
  • LN10
  • LOG2E
  • LOG10E
  • PI
  • SQRT1_2
  • SQRT2
    Metody:
  • abs
  • acos
  • asin
  • atan
  • ceil
  • cos
  • exp
  • floor
  • log
  • max
  • min
  • pow
  • random
  • round
  • sin
  • sqrt
  • tan
    Osetrenie udalosti: Ziadne.


    navigator

    Obsahuje informaciu o pouzivanej verzii Netscape Navigatora.
    Syntax:
    navigator.propertyName
    
    Vlastnosti:
  • appCodeName
  • appName
  • appVersion
  • userAgent
    Metody: Ziadne.
    Osetrenie udalosti: Ziadne.

    password

    Textove pole v html dokumente, ktore namiesto vkladanych znakov zobrazuje '*'.
    Syntax:
    <INPUT
       TYPE="password"
       NAME="passwordName"
       [VALUE="textValue"]
       SIZE=integer>
    
    Vlastnosti:
  • defaultValue
  • name
  • value
    Metody:
  • focus
  • blur
  • select
    Osetrenie udalosti: Ziadne.


    radio

    Mnozina tlacitok v html forme umoznujuca vyber zo zoznamu.
    Syntax:
    <INPUT
       TYPE="radio"
       NAME="radioName"
       VALUE="buttonValue"
       [CHECKED]
       [onClick="handlerText"]>
       textToDisplay
    
    Vlastnosti:
  • checked
  • defaultChecked
  • length
  • name
  • value
    Metody:
  • click
    Osetrenie udalosti:
  • onClick


    reset

    Tlacitko 'reset' v html forme, ktore nastavi vsetky elementy danej formy na ich default hodnoty.
    Syntax:
    <INPUT
       TYPE="reset"
       NAME="resetName"
       VALUE="buttonText"
       [onClick="handlerText"]>
    
    Vlastnosti:
  • name
  • value
    Metody:
  • click
    Osetrenie udalosti:
  • onClick


    select

    Rolovaci alebo vyberovy zoznam v html dokumente, umoznujuci pouzivatelovi vybrat si jednu alebo aj viac poloziek.
    Syntax:
    <SELECT
       NAME="selectName"
       [SIZE="integer"]
       [MULTIPLE]
       [onBlur="handlerText"]
       [onChange="handlerText"]
       [onFocus="handlerText"]>
       <OPTION VALUE="optionValue" [SELECTED]> textToDisplay [ ... <OPTION> textToDisplay]
    </SELECT>
    
    Vlastnosti:
  • length
  • name
  • selectedIndex
  • defaultSelected
  • index
  • length
  • name
  • selected
  • text
  • value
    Metody:
  • blur
  • focus
    Osetrenie udalosti:
  • onBlur
  • onChange
  • onFocus

    string

    Retazec.
    Syntax:
    1. stringName.propertyName
    2. stringName.methodName(parameters)
    
    Vlastnosti:
  • length
    Metody:
  • anchor
  • big
  • blink
  • bold
  • charAt
  • fixed
  • fontcolor
  • fontsize
  • indexOf
  • italics
  • lastIndexOf
  • link
  • small
  • strike
  • sub
  • substring
  • sup
  • toLowerCase
  • toUpperCase
    Osetrenie udalosti: Ziadne.

    submit

    Tlacitko v html forme, ktore ju umoznuje poslat serveru.
    Syntax:
    <INPUT
       TYPE="submit"
       NAME="submitName"
       VALUE="buttonText"
       [onClick="handlerText"]>
    
    Vlastnosti:
  • name
  • value
    Metody:
  • click
    Osetrenie udalosti:
  • onClick


    text

    Vstupne pole pre vkladany text v html forme, umoznujuce pouzivatelovi napisat slovo, vetu alebo serie cisel.
    Syntax:
    <INPUT
       TYPE="text"
       NAME="textName"
       VALUE="textValue"
       SIZE=integer
       [onBlur="handlerText"]
       [onChange="handlerText"]
       [onFocus="handlerText"]
       [onSelect="handlerText"]>
    
    Vlastnosti:
  • defaultValue
  • name
  • value
    Metody:
  • focus
  • blur
  • select
    Osetrenie udalosti:
  • onBlur
  • onChange
  • onFocus
  • onSelect


    textarea

    Viacriadkove vstupne pole v html forme, umoznujuce pouzivatelovi pisat slova, skupiny slov alebo cisla.
    Syntax:
    <TEXTAREA
       NAME="textareaName"
       ROWS="integer"
       COLS="integer"
       [onBlur="handlerText"]
       [onChange="handlerText"]
       [onFocus="handlerText"]
       [onSelect="handlerText"]>
       textToDisplay
    </TEXTAREA>
    
    Vlastnosti:
  • defaultValue
  • name
  • value
    Metody:
  • focus
  • blur
  • select
    Osetrenie udalosti:
  • onBlur
  • onChange
  • onFocus
  • onSelect


    window

    Stoji na vrchole hierarchie objektov. Syntax: Vytvorenie okna:
    windowObject = window.open("URL", "windowName" [,"windowFeatures"])
    
    Vlastnosti:
  • defaultStatus
  • length
  • name
  • parent
  • self
  • status
  • top
  • window
    Metody:
  • alert
  • close
  • confirm
  • open
  • prompt
  • setTimeout
  • clearTimeout
    Osetrenie udalosti:
  • onLoad
  • onUnload