JavascriptEvent list explanation |
Event |
Browser support |
Explanation |
General events |
Onclick |
Ie3, N2 |
This event is triggered when you click the mouse. |
Ondblclick |
Ie4, N4 |
This event is triggered when you double-click the mouse. |
Onmousedown |
Ie4, N4 |
Trigger this event when you press the mouse |
Onmouseup |
Ie4, N4 |
This event is triggered when you press the mouse and release the mouse. |
Onmouseover |
Ie3, N2 |
This event is triggered when you move the cursor over an object range. |
Onmousemove |
Ie4, N4 |
This event is triggered when you move the mouse. |
Onmouseout |
Ie4, N3 |
This event is triggered when the mouse leaves an object range. |
Onkeypress |
Ie4, N4 |
This event is triggered when a key on the keyboard is pressed and released. |
Onkeydown |
Ie4, N4 |
This event is triggered when a button on the keyboard is pressed |
Onkeyup |
Ie4, N4 |
This event is triggered when a button on the keyboard is pressed and opened |
Page related events |
Onabort |
Ie4, N3 |
The image is interrupted by the user during download. |
Onbeforeunload |
Ie4, n |
This event is triggered when the content of the current page is about to be changed |
Onerror |
Ie4, N3 |
This event is triggered when an error occurs. |
Onload |
Ie3, N2 |
This event is triggered when the page content is complete. |
Onmove |
IE, N4 |
This event is triggered when the browser window is moved. |
Onresize |
Ie4, N4 |
This event is triggered when the browser window size is changed |
Onscroll |
Ie4, n |
This event is triggered when the browser's scroll bar position changes. |
Onstop |
Ie5, n |
This event is triggered when the stop button of the browser is pressed or the file being downloaded is interrupted. |
OnUnload |
Ie3, N2 |
This event is triggered when the current page is changed |
Form-related events |
Onblur |
Ie3, N2 |
This event is triggered when the current element loses focus. |
Onchange |
Ie3, N2 |
This event is triggered when the current element loses focus and the element content changes. |
Onfocus |
Ie3, N2 |
This event is triggered when an element gets focus |
Onreset |
Ie4, N3 |
This event is triggered when the reset attribute in the form is fired. |
Onsubmit |
Ie3, N2 |
This event is triggered when a form is submitted. |
Rolling subtitle events |
Onbounce |
Ie4, n |
This event is triggered when content in marquee is moved out of the marquee display range. |
Onfinish |
Ie4, n |
This event is triggered when the marquee element completes the content to be displayed. |
Onstart |
Ie4, n |
This event is triggered when the marquee element begins to display content |
Edit event |
Onbeforecopy |
Ie5, n |
When the selected content on the page is to be copied to the viewerSystemThis event is triggered before the clipboard |
Onbeforecut |
Ie5, n |
When part or all of the content on the page is removed from the current page [clipboard] and moved to the viewer'sSystemThis event is triggered when you clipboard |
Onbeforeeditfocus |
Ie5, n |
The current element is about to enter the editing status. |
Onbeforepaste |
Ie5, n |
Content to be retrieved from the viewer'sSystemThis event is triggered when the clipboard is transferred to the page [pasted ]. |
Onbeforeupdate |
Ie5, n |
Paste as a viewerSystemThe target object is notified when the content in the clipboard is |
Oncontextmenu |
Ie5, n |
Events that are triggered when a viewer presses the right-click button to display a menu or triggers a page menu by pressing the keyboard. |
Oncopy |
Ie5, n |
This event is triggered when the selected content on the page is copied. |
Oncut |
Ie5, n |
This event is triggered when the selected content on the page is cut |
Ondrag |
Ie5, n |
This event [activity event] is triggered when an object is dragged. |
Ondragdrop |
IE, N4 |
An external object is dragged to the current window or frame by the mouse |
Ondragend |
Ie5, n |
This event is triggered when the mouse drag ends, that is, the mouse button is released |
Ondragenter |
Ie5, n |
This event is triggered when an object that is dragged by the mouse enters its container range. |
Ondragleave |
Ie5, n |
This event is triggered when an object that is dragged by the mouse leaves its container range. |
Ondragover |
Ie5, n |
This event is triggered when a dragged object is dragged within the range of another object container. |
Ondragstart |
Ie4, n |
This event is triggered when an object is dragged. |
Ondrop |
Ie5, n |
This event is triggered when the mouse key is released during a drag process. |
Onlosecapture |
Ie5, n |
This event is triggered when an element loses the focus of selection formed by moving the mouse. |
Onpaste |
Ie5, n |
This event is triggered when the content is pasted |
Onselect |
Ie4, n |
Event when text content is selected |
Onselectstart |
Ie4, n |
Event triggered when the text content is selected |
Data Binding |
Onafterupdate |
Ie4, n |
This event is triggered when data is transferred from the data source to the object. |
Oncellchange |
Ie5, n |
When the data source changes |
Ondataavailable |
Ie4, n |
Event triggered when data reception is complete |
Ondatasetchanged |
Ie4, n |
Events triggered when data sources change |
Ondatasetcomplete |
Ie4, n |
This event is triggered when all valid data of the Child data source is read. |
Onerrorupdate |
Ie4, n |
When the onbeforeupdate event is used to trigger the cancellation of data transfer, the onafterupdate event is replaced |
Onrowenter |
Ie5, n |
Events triggered when the data in the current data source changes and new valid data exists |
Onrowexit |
Ie5, n |
Event triggered when the data of the current data source is about to change |
Onrowsdelete |
Ie5, n |
This event is triggered when the current data record is deleted. |
Onrowsinserted |
Ie5, n |
This event is triggered when the current data source is about to insert a new data record |
External events |
Onafterprint |
Ie5, n |
This event is triggered when the document is printed |
Onbeforeprint |
Ie5, n |
This event is triggered when the document is about to be printed |
Onfilterchange |
Ie4, n |
Events triggered when the filter effect of an object changes |
Onhelp |
Ie4, n |
This event is triggered when the viewer presses F1 or the browser's help selection. |
Onpropertychange |
Ie5, n |
This event is triggered when one of the object attributes changes. |
Onreadystatechange |
Ie4, n |
This event is triggered when the object's initialization property value changes. |
Events that can be used by JavaScript
Javascript is a client scripting language that works with htmlhtml. However, this is not a javsscript guide. We focus on how to use JavaScript in HTML.
Javascript events are used like HTML tag attributes. An event is a behavior that occurs on an HTML element, such as when it is clicked or when it loses focus.
<A href = "# Top" onclick = "alert ('Wow. Javascript. ')"> click me </a>
The following events can be used:
Onblur (used in form elements, executed when the element loses focus)
Onchange (used in form elements, when something changes, it is executed)
Onclick (execute when you click an element)
Ondblclick (executed when you double-click an element)
Onfocus (used in form elements and executed when the element gets Focus)
Onkeydown (executed when a key is pressed)
Onkeypress (executed when a key is pressed and released)
Onkeyup (executed when a key is released)
Onload (used in the body label and executed when loading the page)
Onmousedown (executed when you press the mouse button)
Onmousemove (executed when the cursor moves over the element)
Onmouseout (executed when the mouse moves the element away)
Onmouseover (executed when the mouse cursor moves over the element)
Onmouseup (executed when the mouse button is released)
Onreset (used in form elements and executed when the form is reset)
Onselect (used in form elements, executed when an element is selected)
Onsubmit (used in form elements and executed when the form is submitted)
OnUnload (used in the body label and executed when the page is closed)
Do not lose self-control over JavaScript. It is best to use less. A web page using JavaScript has the risk of significantly reducing ease of use, and many things can replace it, such as the server-side scripting language PHP or ASP.
Bytes ------------------------------------------------------------------------------------------
Dom Programming
1javascript uses the browser itself, webpage documents, and HTML elements in Webpage documents to express them with the corresponding built-in ones that you like, the hierarchical relationships between these objects are collectively referred to as Dom (Document Object Model, Document Object Model)
DHTML
2
CSS, scriptProgramming LanguageCombined with Dom, HTML documents can be interactive and dynamically transformed with users. The single title of these three technologies is DHTML (Dynamic HTML, dynamic HTML)
In the browser, do not right-click to openCode
<HTML>
<Head>
<Script language = "JavaScript">
<! --
Function hidecontestmenu ()
{
Window. event. returnvalue = false;
}
// --> To prevent other browsers from using the HTML comment end tag as the comment cripProgramCode
</SCRIPT>
<Head>
<Body oncontextmenu = "Return false;/* hidecontextmenu () */">
</Html>
2. directly set the event attribute of the Element Object in JavaScript code, so that the event property value is equal to the function name or program code that processes the event, and the execution is interpreted to generate an error.
<Script language = "JavaScript">
Document. oncontextmenu = hidecontextmenu;
Function hidecontestmenu ()
{
Return false;
}
</SCRIPT>
3. Compile an event handler code for an element object in a special <SCRIPT> tag pair and use the for attribute to specify the event source and the event attribute to specify the event name.
<Script language = "JavaScript" for = "document" event = "oncontextmenu">
Windows. event. returnvalue = false;
</SCRIPT>
Windows objects
1. Windows objects represent the entire window of the browser. programmers can use Windows objects to control all aspects of the browser window,
Windows Object -- Method
1. Alert
2. Confirm
3. the prompt displays
4. Navigate to other pages
5. setinterval: Set how long the browser regularly calls and executes the specified code.
6. setTimeout: Set the browser to execute the Specified Code after a long time
7. clearinterval method, used to cancel setinterval settings
8. cleartimeout cancel setTimeout
9. moveTo move the browser to a location in the browser
10. resizeTo change the browser window size
11. The open method is used to open a new window,
12. showmodaldialog method, used to generate a modal dialog box window
13. showmodelessdialog method, used to generate a non-modal dialog box window