Answers

Question and Answer:

  Home  DHTML

⟩ How to Handle Events with DHTML?

Event is use to trigger actions in the browser. When client click on the element, associated action will started.Like: an JavaScript will started when client click on element.

Using Event Handler we can do like that,When an event occur it will execute code associated with that element.

Example:

In this example header will changes when client clicks.

<h1 onclick="this.innerHTML='abc!'">Click on this text</h1>

We can add a script in the head section and then we call the function from the event handler.

Example:

<html>

<head>

<script type="text/javascript">

function changetext(id)

{

id.innerHTML="abc!";

}

</script>

</head>

<body>

<h1 onclick="changetext(this)">Click on this text</h1>

</body>

</html>

 194 views

More Questions for you: