Documentation for HTML:WITH-EVENT-HANDLERS



HTML4.0:WITH-EVENT-HANDLERS [macro]: ((VARIABLE &REST CLAUSES) &BODY BODY)
Binds VARIABLE within scope of BODY to client-side event handlers specified by CLAUSES .

CLAUSES is list of languages and event-clauses of the form:

     (SCRIPTING-LANGUAGE &rest EVENTS).

EVENTS are a sequence of EVENT COMMAND pairs of the form:

     (EVENT1 COMMAND1 EVENT2 COMMAND2 ...)

EVENT can be any event keyword for SCRIPTING-LANGUAGE and COMMAND is either a string,
an s-expression returning a string or a function. If it returns a function, the
function will be called on STREAM to emit the script calling string.

Normal usage involves using DEFINE-SCRIPT to define a script object which is then reused via the
EVENT-CALLER method.  EVENT-CALLER returns a function that writes the correct invocation string.

Any number of EVENT and COMMAND pairs can be bound or one or more scripting languages.

*EVENT-HANDLERS* holds the valid events available for each known scripting languages.

Valid HTML 4.0.1 events

   :LOAD                The onload event occurs when the user agent finishes loading a window or all
                        frames within a FRAMESET. This attribute may be used with BODY and FRAMESET
                        elements.

   :UNLOAD              The onunload event occurs when the user agent removes a document from a
                        window or frame. This attribute may be used with BODY and FRAMESET elements.

   :MOUSE-CLICK         The onclick event occurs when the pointing device button is clicked over an
                        element. This attribute may be used with most elements.

   :MOUSE-DOUBLE-CLICK  The ondblclick event occurs when the pointing device button is double
                        clicked over an element. This attribute may be used with most elements.

   :MOUSE-DOWN          The onmousedown event occurs when the pointing device button is pressed over
                        an element. This attribute may be used with most elements.

   :MOUSE-UP            The onmouseup event occurs when the pointing device button is released over
                        an element. This attribute may be used with most elements.

   :MOUSE-OVER          The onmouseover event occurs when the pointing device is moved onto an
                        element. This attribute may be used with most elements.

   :MOUSE-MOVE          The onmousemove event occurs when the pointing device is moved while it is
                        over an element. This attribute may be used with most elements.

   :MOUSE-OUT           The onmouseout event occurs when the pointing device is moved away from
                        an element. This attribute may be used with most elements.

   :INPUT-FOCUS         The onfocus event occurs when an element receives focus either by the
                        pointing device or by tabbing navigation. This attribute may be used with
                        the following elements: A, AREA, LABEL, INPUT, SELECT, TEXTAREA, and BUTTON.

   :INPUT-DEFOCUS       The onblur event occurs when an element loses focus either by the pointing
                        deviceor by tabbing navigation. It may be used with the same elements as
                        onfocus.

   :KEY-PRESS           The onkeypress event occurs when a key is pressed and released over an
                        element.This attribute may be used with most elements.

   :KEY-DOWN            The onkeydown event occurs when a key is pressed down over an element.
                        This attribute may be used with most elements.

   :KEY-UP              The onkeyup event occurs when a key is released over an element. This
                        attribute may be used with most elements.

   :SUBMIT              The onsubmit event occurs when a form is submitted. It only applies to the
                        FORM element.

   :RESET               The onreset event occurs when a form is reset. It only applies to the
                        FORM element.

   :SELECT              The onselect event occurs when a user selects some text in a text field.
                        This attribute may be used with the INPUT and TEXTAREA elements.

   :NEW-VALUE           The onchange event occurs when a control loses the input focus and its value
                        has been modified since gaining focus. This attribute applies to the
                        followingelements: INPUT, SELECT, and TEXTAREA.

Here is an example of how to use this macro.

  (with-document-preamble (:stream stream)
    (declare-script script stream))
  (with-document-body (:stream stream)
    (with-event-handlers
      (events
        (:java-script
          :new-value (event-caller script 10 20)))
      (accept-input 'string query-name
                    :events events
                    :stream stream)))

CL-HTTP/70.216 (LispWorks; 2.1.7)