Event
NSB/App Studio programs run within a special version of a web browser. As a result, they can inherit a lot of the properties of the environment they run in. You can access these properties from within your app.
It is not a complete list: there are additional items in the full HTML documentation. In addition, some browsers may have additional members not shown here.
The event object gets created when an event occurs in your program. Events are usually the result of some interaction on the screen by the user: a click, a mouse move or a field selected. You can assign the name of a function in your program to each of these events. In your function, you can examine the values in the Event object to find out more about what just happened.
You can set an event for an element as follows:
document.body.onmousedown=bodyMouseDown
When there is a click anywhere in the body, the function bodyMouseDown will be called in your program. You can then examine the event object to find out more information:
Function bodyMouseDown() MsgBox event.type & " at " & event.clientX & "," & event.clientY End Function
list of events
onblur | An element loses focus | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onchange | The content of a field changes | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onclick | Mouse clicks an object | ||||||||||||||||||||||||||||||||||||||||||||||||||||
ondblclick | Mouse double-clicks an object | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onerror | An error occurs when loading a document or an image | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onfocus | An element gets focus | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onkeydown | |||||||||||||||||||||||||||||||||||||||||||||||||||||
onkeypress | A keyboard key is pressed or held down | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onkeyup | A keyboard key is released | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onmousedown | A mouse button is pressed | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onmousemove | The mouse is moved | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onmouseout | The mouse is moved off an element | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onmouseover | The mouse is moved over an element | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onmouseup | A mouse button is released | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onresize | A window or frame is resized | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onselect | Text is selected | ||||||||||||||||||||||||||||||||||||||||||||||||||||
onunload | }
event properties
ExampleYou can set an event for an element as follows: document.body.onmousedown=bodyMouseDown When there is a click anywhere in the body, the function bodyMouseDown will be called in your program. You can then examine the event object to find out more information: Function bodyMouseDown() MsgBox event.type & " at " & event.clientX & "," & event.clientY End Function |