Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos

    As you know, some htmlb tags have got ClientSide scripting, some do not have. And every html page which dares to be a well programmed page should have as much scripting logic as possible. Concerning the time which is spent by a user of a html page, it is better to implement client side logic. It means JS(JavaScript).

    This leads to a question: is it possible to attach more javascript functions for html page events? If yes, how to do it?

The answer  for the 1st question is YES. The answer for the 2nd question includes:

1) at the end of your .htm page you have to include a run of a function which adds servicing the needed events for needed html elements, eg.

add_onblur();

2) at the

part of your .htm page (it should be here, not has to) you have to implement this function, eg.

function add_onblur()
{
        e = document.getElementById( 'some_id' );
        if ( e )
        {
            e.onblur = function()

            {    

                if (this.value.length < 1)
                {
                    alert ('Please give ...');
                }

             }

        }

}

This described solution is simply an obvious DOM implementation, and the only elements which may to seem difficult are:

- implementing the event for an html element can be done by an expression: function() { .....} 

- in this function, you use this to get to current element.

 

 Where can you use this solution? For example:

- to chceck the value of an input text field (htmlb inputField)

- to limit the lengh of a value in a textarea (htmlb textEdit) -> event onkeyup

- to re-set options in select (htmlb dropdownListBox)