HTC is an acronym for HTML component and is a client component supported by IE5 and subsequent versions of browsers. As far as I understand it, HTC is a set of scripts that encapsulate client behavior on a DHTML basis, each HTC with *.HTC file storage, and one HTC is a client "class".
Object
Document displays HTML documents in a given browser window.
Element returns a reference to the label of the connection behavior in the main document.
Public:attach binds a function to an event, so the function is invoked every time an event occurs on a particular object.
Public:component the contents of the file with HTC.
Public:defaults set a default attribute for HTC.
Public:event defines an HTC event that exposes it to a document containing the HTC.
Public:method defines an HTC approach that exposes it to documents containing the HTC.
Public:property defines an HTC attribute that is exposed to documents that contain the HTC.
Method
Createeventobject
Creates an event object that is used when you need to pass the event additional information to the fire method of the public:event element.
Event
Oncontentready
Occurs when the contents of the element that connect the behavior are completely parsed.
Oncontentsave
The content of an element that is connected to an element behavior occurs before it is saved or copied.
Ondetach
Occurs before an element is released from a connection to a behavior.
Ondocumentready
Occurs when the document that contains the behavior is completely parsed.
Example
Copy Code code as follows:
<PUBLIC:COMPONENT>
<public:property name= "Grid"/><!--return to the current grid, through which you can access information about the current grid-->
<!--and DataColumn definitions in. NET are similar to-->
<public:property name= "ColumnName"/> <!--column name-->
<public:property name= "DataType"/><!--data types, such as System.String, and smartgridcolumn values on DataType are consistent-->
<public:property name= "Allownull"/><!--whether NULL is allowed-->
<public:property name= "scale"/>
<public:property name= "precision"/><!--precision, mainly for digital-->
<public:property name= "MaxLength"/><!--maximum length, mainly for text-->
<public:property name= "ExtendedProperties"/><!--generally use XML strings, because parsing is very handy when storing a lot of information-->
<public:method name= "Select"/><!--all selected. Because the reference edit box consists of input and IMG, you need to overwrite (overload) the Select method-->
<public:method Name= focuses ><!--focus. Because the reference edit box consists of input and IMG, you need to overwrite (overload) the focus method-->
<public:property name= "Input" get= "GetInput"/>
<public:property name= "value" get= "GetValue" put= "SetValue"/>
<public:method name= "Celldatacheck"/>
</PUBLIC:COMPONENT>
<script language= "JavaScript" >
var id = null;
The reference generally has two values, one is the text displayed, and one is the ID. Idcolumn the grid column that indicates the ID
var idcolumn = null;
var refurl = null;
var refidcolumn = null;
var refnamecolumn = null;
var extendedprop = element.extendedproperties;
if (extendedprop!= null && typeof (Extendedprop)!= "undefined")
{
var dom = new ActiveXObject ("MSXML"). DOMDocument ");
Dom.loadxml (Extendedprop);
Idcolumn = Dom.documentElement.getAttribute ("Idcolumn");
var refinfo = Dom.documentElement.firstChild;
Refidcolumn = Refinfo.getattribute ("Idcolumn");
Refnamecolumn = Refinfo.getattribute ("NameColumn");
Refurl = Refinfo.getattribute ("url");
}
var btn = element.getelementsbytagname ("IMG") [0];
Btn.onclick = Btnclick;
function Btnclick ()
{
var ret = window.showModalDialog (refurl,self, ' scrolling:no;resizable:no;status:no;dialogwidth:550px;dialogheight : 450px;center:1 ');
if (ret!= null)
{
var el = Ret.documentElement.firstChild;
if (El!= null)
{
Input.value = El.getattribute (Refnamecolumn);
if (idcolumn!= null && idcolumn!= "")
{
id = el.getattribute (refidcolumn);
Grid.setcellvalue (Grid.row,idcolumn,id);
}
}
}
//--------------------------------------------------------------
Grid.setcellvalue (grid.row, "num", 100); Assignment example
Grid.setcellvalue (Grid.Row, "price", 10); Assignment example
//-------------------------------------------------------------
}
var statustext = "";
var input = element.getelementsbytagname ("input") [0];
Input.onblur = Inputonblur;
function Inputonblur ()
{
Grid.status = StatusText; You can modify the state of the grid status bar by Grid.status.
}
function GetInput ()
{
return input;
}
This method is called by SmartGrid when the editor is displayed. Since the reference editor is composed of input, IMG and other elements, you need to tell SmartGrid which element to focus on when setting the editor focus!
function Focus ()
{
Input.focus ();
}
This method is invoked by SmartGrid when the editor is all selected. Because the reference editor consists of input, IMG and other elements, so you need to tell SmartGrid in the full selection of editor content, how should select all!
function Select ()
{
Input.select ();
}
Function SetValue (val)
{
Input.value = val;
if (idcolumn!= null)
{
var r = Grid.Row;
id = grid.getcellvalue (r,idcolumn);
}
}
function GetValue ()
{
return input.value;
}
function Celldatacheck (args)
{
return;
}
</script>