JavaScript Program to Demonstrate Focus and Blur Events

Write a JavaScript program to demonstrate focus and blur events.

Source Code
    <title>Changing focus of form text element</title>
<input type="text" id="txt1"/><br/>
<input type="text" id="txt2"/>
        var t1 = document.getElementById('txt1');
        t1.onfocus = focus;
        t1.onblur = blur;

        var t2 = document.getElementById('txt2');
        t2.onfocus = focus;
        t2.onblur = blur;

        function focus()
            this.value = "In Focus";
        function blur()
            this.value = "Focus Lost";