JavaScript Collection

xiaoxiao2021-04-09  498

Some JavaScript tips collected!

Event source object

Event.srcelement.tagname

Event.srcelement.Type

Capture release

Event.srcelement.setcapture ();

Event.srcelement.releasecapture ();

Event button

Event.Keycode

Event.shiftKey

Event.altKey

Event.ctrlKey

Event return value

Event.ReturnValue

Mouse location

Event.x

Event.y

Form activity element

Document.ActiveElement

Binding event

Document.captureEvents (Event.KeyDown);

Access form elements

Document.all ("txt"). FOCUS ();

Document.all ("txt"). SELECT ();

Form command

Document.execcommand

Form cookie

Document.cookie

Menu event

Document.onContextMenu

Create an element

Document.createElement ("span");

Element according to the mouse:

Document.ementFromPoint (event.x, time.y) .tagname == "TD

Document.ementFromPoint (Event.x, Event.y) .appendchild (ms)

Form image

Document.Images [index]

Form event binding

Document.οnmοusedοwn = scrollwindow;

element

Document. Form. Elements [index]

Object binding event

Document.all.xxx.detachevent ('Onclick', A);

Plugin number

Navigator.plugins

Variable type

TypeOf ($ JS_LIBPATH) == "undefined"

Pull down box

Drop the box .options [index]

Drop the box .options.Length

Find object

Document.getlementsByname ("R1");

Document.getlementByID (ID);

timing

Timer = setInterval ('scrollwindow ()', delay);

ClearInterval (Timer);

UNCODE encoding

Escape (), unescape

Parent

Obj.parentelement (DHTML)

Obj.parentNode (DOM)

Exchange table

TableID.MOVEROW (2, 1)

Replace CSS

Document.all.css.href = "a.css";

Parallel display

Display: inline

Hidden focus

Hidefocus = true

Wrap according to the width

Style = "Word-Break: Break-all"

Auto Refresh

Simple mail

Quick transfer to position

Obj.Scrollintoview (True)

anchor

Anchors web page delivery parameters

Location.Search ();

editable

Obj.conteTedITable = true

Execute a menu command

Obj.execcommand

Double-character character

/ [^ / X00- / XFF] /

Chinese character

/ [/ u4e00- / u9fa5] /

Let the English string exceed the table width automatic wrap

Word-Wrap: Break-Word; Word-Break: Break-all;

Transparent Background