Home  >  Article  >  Web Front-end  >  Some JAVASCRIPT technologies that you can refer to when making web pages

Some JAVASCRIPT technologies that you can refer to when making web pages

黄舟
黄舟Original
2016-12-14 15:54:321022browse

Event source object
event.srcElement.tagName
event.srcElement.type
Capture release
event.srcElement.setCapture();
event.srcElement.releaseCapture();
Event key
event.keyCode
event.shiftKey
event .altKey
event.ctrlKey
Event return value
event.returnValue
Mouse position
event.x
event.y
Form active element
document.activeElement
Binding event
document.captureEvents(Event.KEYDOWN);
Access Form element
document.all("txt").focus();
document.all("txt").select();
Form command
document.execCommand
Form COOKIE
document.cookie
Menu event
document.oncontextmenu
Create element
document.createElement("SPAN");
Get the element based on the mouse:
document.elementFromPoint(event.x,event.y).tagName=="TD
document.elementFromPoint(event.x , event.y).appendChild(ms)
Form pictures
document.images[index]
Form event binding
document.onmousedown=scrollwindow;
Elements
document.Form.elements[index]
Object binding Event
document.all.xxx.detachEvent('onclick',a);
Number of plug-ins
navigator.plugins
Get variable type
typeof($js_libpath) == "undefined"
Drop-down box
Drop-down box.options[index]
Drop-down box.options.length
Find object
document.getElementsByName("r1");
document.getElementById(id);
Timing
timer=setInterval('scrollwindow()',delay);
clearInterval(timer);
UNCODE encoding
escape(),unescape
Parent object
obj.parentElement(dhtml)
obj.parentNode(dom)
Exchange table rows
TableID.moveRow(2,1)
Replace CSS
document.all.csss. href = "a.css";
Display side by side
display:inline
Hide focus
hidefocus=true
Wrap according to width
style="word-break:break-all"
Auto refresh

Simple email

Quick transfer To the location
obj.scrollIntoView(true)
anchor

anchors
Pass parameters to the web page
location.search();
Editable
obj.contenteditable=true
Execute menu command
obj.execCommand
Double-byte characters
/[^x00-xff]/
Chinese characters
/[u4e00-u9fa5]/
Let the English string exceed the table width automatically Line break
word-wrap: break-word; word-break: break-all;
Transparent background

Get style content
obj.style.cssText
HTML tag
document.documentElement.innerHTML
The first style tag
document.styleSheets[0]
The first style in the style tag
document.styleSheets[0].rules[0]
Prevent When clicking an empty link, the page often resets to the top of the page.
word
Previous page source
asp:
request.servervariables("HTTP_REFERER")
javascript:
document.referrer
Release memory
CollectGarbage( ; select
Address bar icon

favicon.ico The best name should be 16*16 in 16 colors, and placed in the root directory of the virtual directory
Favorite bar icon

View source code

Close input method

Automatically select all

ENTER key can move the cursor to the next input Box

Default value of text box

title line break
obj.title = "123 sdfs "
Get the microsecond represented by the time
var n1 = new Date("2004-10-10".replace(/-/g, "/" )).getTime()
Whether the window is closed
win.closed
checkbox flat


Get selected Content
document.selection.createRange().duplicate().text
Autocomplete function
Turn on this function
Turn off this function
Maximum window

No close button IE
window. open("aa.htm", "meizz", "fullscreen=7");
Uniform encoding/decoding
alert(decodeURIComponent(encodeURIComponent("http://hello.com?as= hehe")))
encodeURIComponent Also encodes ":", "/", ";" and "?"
Table row instructions

For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn