Home >Web Front-end >JS Tutorial >Some JAVASCRIPT technologies that you can refer to when making web pages
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
For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!