In. NET development, taking full advantage of free controls is a good thing, similarly, in PHP open, can use the Ajax class library is OK, but if you can not modify the control or class library to meet their own needs, it is necessary to use JS Dafa, the premise is to study the browser model of the various objects of the method properties. Especially familiar with css+html will do very cool. The JS language itself is not a high requirement.
1, dynamic Delete table inside content skills, do not need to write too much code, one line:
Tb.removenode (True) 3g.mlybyby.com
2, dynamic increase in line, in addition to the CreateElement method, can also be relatively short:
3. Dynamically add table in div
4, delete the table in the Div, simple as long as div.innerhtml= "" can.
The above is a few practical relatively short code, of course, there are other ways to achieve, but generally longer than the above, such as the combination of the use of Div object insertAdjacentHTML method, the use of different methods under different needs, the premise is to study the browser model of the various objects of the method properties. Especially familiar with css+html will do very cool. The JS language itself is not a high requirement.
Here is an example of the Document object, which is related to the following methods:
Method Description
Attachevent
CreateAttribute
Createcomment
Createdocumentfragment
CreateElement
Createeventobject
createStyleSheet
createTextNode
DetachEvent
getElementById
Getelementsbyname
getElementsByTagName
Mergeattributes
Recalc
Write
Writeln
In the case of Div objects, the relevant methods are:
Addbehavior
AppendChild
Applyelement
Attachevent
Clearattributes
CloneNode
Contains
DetachEvent
Getadjacenttext
GetAttribute
GetAttributeNode
getElementsByTagName
HasChildNodes
Insertadjacentelement
insertAdjacentHTML
insertAdjacentText
InsertBefore
Mergeattributes
Normalize
RemoveAttribute
RemoveAttributeNodewww.hrbnzyy.com
Removebehavior
RemoveChild
Removeexpression
RemoveNode
Replaceadjacenttext
ReplaceChild
ReplaceNode
SetActive
SetAttribute
Setattributenode
SetExpression
Other, such as drop-down list objects, and drag-and-drop operations I have time to collate and compare, to achieve the same function, relatively short of wonderful code is worth collecting.
RemoveNode (true) non-IE browser not supported, should be used Obj.parentNode.removeChild (obj); www.hrbnzyy120.com
InsertRow (x) InsertCell (y) This parameter is IE can be default, but in non-IE browser is not the default
As for Insertadjacentelement InnerText These are the unique methods of IE, not the standard, should be noted.
AJAX-related JS code snippets and partial browser models