DHTLM Events - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

DHTLM Events

Description:

h1 onclick='style.color='red'' Click on this text /h1 ... onclick. a user changes the value of an object. onchange. a user leaves an object. onblur ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 9
Provided by: dul3
Category:

less

Transcript and Presenter's Notes

Title: DHTLM Events


1
DHTLM Events
2
DHTML Event Handlers
  • With an event handler you can do something with
    an element when an event occurs.

3
Event handlers
  • With an event handler you can do something with
    an element when an event occurs when the user
    clicks an element, when the page loads, when a
    form is submitted, etc.

4
Example
  • lth1 onclick"style.color'red'"gtClick on this
    textlt/h1gt
  • The example above defines a header that turns
    red when a user clicks on it.

5
  • You can also add a script in the head section of
    the page and then call the function from the
    event handler

6
Example
  • lthtmlgt
  • ltheadgt
  • ltscript type"text/javascript"gt
  • function changecolor() document.getElementById('
    header').style.color"red"
  • lt/scriptgt
  • lt/headgt
  • ltbodygt lth1 id"header" onclick"changecolor()"gt
    Click on
  • this textlt/h1gt
  • lt/bodygt
  • lt/htmlgt

7
HTML 4.0 Event Handlers
8
HTML 4.0 Event Handlers
Write a Comment
User Comments (0)
About PowerShow.com