Zhang Xiaoxiang (5-1)

Source: Internet
Author: User
DHTML
1. js uses built-in objects to represent the browser itself, webpage documents, and HTML elements.
The hierarchical relationship between these objects is called Dom (Document Object Model)
2. Some objects exist as attributes of other objects.
3. Event and event source. Each object supports several events, and each object can be an event source.
User actions can generate events, and the browser itself also has events, such as loading load and disabling unload.
4. Events tell us what operations the user has performed or what operations the browser has performed.
5. associate a piece of code with an event on an event source. When this event occurs on the event source,
The browser will automatically execute the associated program code, which triggers a series of program actions, called events.
An event driver is a function that processes events. It is called an event handler)
6. DHTML (Dynamic HTML) = CSS + JS + DOM is a W3C standard.
7. hierarchical relationship
Window (top-level, representing the entire browser object)
Location (properties of the window object)
Frames
..
Document
Links (direct or indirect attributes of Document)
Images
..
Body
8. Three Methods for associating event handlers
1. Add an event attribute on the HTML tag to make the event attribute equal to the function name or program code that processes the event.
Function hidecontextmenu () {window. event. returnvalue = false ;}
<Body oncontextmenu = "hidecontextmenu ()">
It can be considered that document represents <body>
Here, the default context processing of the body is to open the right-click menu. Generally, after the browser finishes processing the event,
The default processing program is automatically called. If returnvalue is set to false, the default processing of the current event is canceled.
2. troubleshooting: Check whether the function is called first, and then check whether the function is faulty.
1. Add the segments to alert (); determine the range.
2. view the prompt in the browser status bar. Click and click details to view the error message.
Several rows and columns are displayed with errors. CTRL + G to A Row.
3. Return false cancel the default processing. Add the return value to the event processing function,
Oncontextmenu = "Return hide ()"
4. write code directly in the attribute
<A href = "www.163.com" onclick = "Return false"> 163 </a>
5. Method 2: Define the event handler for the tag directly in Js.
<SCRIPT>
Document. oncontextmenu = hidecontextmemu;
Function hidecontextmenu () {return false ;}</SCRIPT>
6. Third, dedicated tag pairs. Commonly Used in Plug-in processing.
<Script for = "document" event = "oncontextmenu">
Window. event. returnvalue = false; </SCRIPT>
7. The call to return false; must use the return function name.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.