JavaScript-event object, javascript-Event

Source: Internet
Author: User

JavaScript-event object, javascript-Event
JavaScript event object

  • Event. srcElement. tagName event. srcElement. type
  • Capture and release event. srcElement. setCapture (); event. srcElement. releaseCapture ();
  • Event. keyCode event. shiftKey event. altKey event. ctrlKey
  • Event return value event. returnValue
  • Mouse position event. x event. y
  • Form Activity element document. activeElement
  • Bind Event document. captureEvents (Event. KEYDOWN );
  • Access the form Element document. all ("txt"). focus (); document. all ("txt"). select ();
  • Form command document.exe cCommand
  • Form COOKIE document. cookie
  • Menu event document. oncontextmenu
  • Create the document. createElement ("SPAN") element ");
  • Get the element with the mouse: document. elementFromPoint (event. x, event. y). tagName = "TD document. elementFromPoint (event. x, event. y). appendChild (MS)
  • Form image document. images [Index]
  • Form event binding document. onmousedown = scrollwindow;
  • Element document. Form. elements [Index]
  • Object binding event document. all. xxx. detachEvent ('onclick', );
  • Number of ins navigator. plugins
  • Take the variable type typeof ($ js_libpath) = "undefined"
  • Drop-down box. options [Index] drop-down box. options. length
  • Search for the object document. getElementsByName ("r1"); document. getElementById (id );
  • Timed timer = setInterval ('rollwindow () ', delay); clearInterval (timer );
  • UNCODE encoding escape (), unescape
  • Parent object obj. parentElement (dhtml) obj. parentNode (dom)
  • Exchange table row TableID. moveRow (2, 1)
  • Replace CSS document.all.css s. href = "a.css ";
  • Display: inline
  • Hide focus hidefocus = true
  • Wrap style = "word-break: break-all" according to the width"
  • Auto refresh <meta HTTP-EQUIV = "refresh" CONTENT = "8; URL = http://c98.yeah.net">
  • Simple Mail <a href = "mailto: aaa@bbb.com? Subject = ccc & body = xxxyyy ">
  • Quickly go to the position obj. scrollIntoView (true)
  • Anchors
  • Webpage transfer parameter location. search ();
  • Editable obj. contenteditable = true
  • Execute the menu command obj.exe cCommand
  • Double-byte characters/[^ "x00-" xff]/Chinese characters/["u4e00-" u9fa5]/
  • Wrap the word-wrap: break-word; word-break: break-all when the English string exceeds the table width;
  • Transparent background <IFRAME src = "1.htm" width = 300 height = 180 allowtransparency> </iframe>
  • Get the style content obj.style.css Text
  • HTML Tag document.doc umentElement. innerHTML
  • First style label document. styleSheets [0]
  • The first style in the style label document. styleSheets [0]. rules [0]
  • When you click an empty link, the page is often reset to the top. <A href = "javascript: function ()"> word </a>
  • Source asp: request. servervariables ("HTTP_REFERER") javascript: document. referrer
  • Release memory CollectGarbage ();
  • Right-click document. oncontextmenu = function () {return false ;}
  • Disable <noscript> <iframe src = "*. htm"> </iframe> </noscript>
  • Do not select <body oncontextmenu = "return false" ondragstart = "return false" onselectstart = "return false" onselect = "document. selection. empty () "oncopy =" document. selection. empty () "onbeforecopy =" return false "onmouseup =" document. selection. empty ()>
  • Disable <input type = text onpaste = "return false">
  • The address bar Icon <link rel = "Shortcut Icon" href = "favicon. ico"> the favicon. ico name should remain the 16 colors of 16*16, and put it in the root directory of the virtual directory.
  • <Link rel = "Bookmark" href = "favicon. ico">
  • View source Code <input type = button value = view webpage source code onclick = "window. location = 'view-source: '+ 'HTTP: // www.csdn.net/'">
  • Disable the input method <input style = "ime-mode: disabled">
  • Automatically select all <input type = text name = text1 value = "123" onfocus = "this. select ()">
  • ENTER allows the cursor to move to the next input box <input onkeydown = "if (event. keyCode = 13) event. keyCode = 9">
  • Default value of the text box <input type = text value = "123" onfocus = "alert (this. defaultValue)">
  • Title newline obj. title = "123 sdfs"
  • Returns the millisecond var n1 = new Date ("2004-10-10". replace (/-/g, ""/"). getTime ()
  • Whether to close windows win. closed
  • Checkbox flat <input type = checkbox style = "position: absolute; clip: rect (5px 15px 15px 5px)"> <br>
  • Obtain the selected content document. selection. createRange (). duplicate (). text
  • <Input type = text autocomplete = on> enable this function <input type = text autocomplete = off> to disable this function.
  • Window maximization <body onload = "window. resizeTo (window. screen. width-4, window. screen. height-50); window. moveTo (-4,-4)">
  • IE window. open ("aa.htm", "meizz", "fullscreen = 7 ");
  • Unified encoding/Decoding of alert (decodeURIComponent (encodeURIComponent ("http: // hello. com? As = hehe ") encodeURIComponent for": ","/","; "and "? "Also Encoding
  • Table row indication <tr onmouseover = "this. bgColor = '# f0f0f0'" onmouseout = "this. bgColor = '# ffff'">

What is the javascript event object issue?

In fact, buttons and so on are all dom objects, but javascript can reference and operate on them. At the same time, javascript also has some function methods to operate on them. Those objects belong to browsers and are not built-in javascript.
The second problem is not to say that type = button is changed to a js object, and that this points to the input object.
Question 3: these are all html element objects, that is, html dom objects. They are not js objects, but javascript can operate on them, which is treated as an object.

How can javascript events call other objects?

A = document. getElementsByName ("wenbenkuang ")
B = document. getElementsByName ("wenbenyu ")
For (I = 0, len = a. length; I <len; I ++ ){
A [I]. onfocus = new function (){
Var _ I = I;
Return function (){
This. style. display = 'none ';
B [_ I]. style. display = "block"; // times? Or this line? Add _ I + 1 to the next row, and then directly add _ I
}
}
}

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.