/*
Extended Library source code
Myex. js
*/
VaR myex = {};
Myex. init = function (){
Ss = Document. getelementsbytagname ("span ");
For (I = 0; I <ss. length; I ++ ){
If (ss [I]. myex ){
Ss [I]. attachevent ("onclick", function (){
VaR oo = event. srcelement;
VaR ext = oo. myex;
If (EXT = "selectex "){
VaR o_myselectex = Document. getelementbyid ("_ myselectex ");
If (! O_myselectex ){
O_myselectex = Document. createelement ("select ");
O_myselectex.id = "_ myselectex ";
O_myselectex.style.position = "absolute ";
O_myselectex.style.top = oo. offsettop;
O_myselectex.style.pixelleft = oo. offsetleft
O_myselectex.style.width = oo. offsetwidth;
O_myselectex.style.visibility = "visible ";
OO. style. Visibility = "hidden ";
/*
O_option = Document. createelement ("option ");
O_option.innertext = oo. innertext;
O_myselectex.options.appendchild (o_option );
O_option = Document. createelement ("option ");
O_option.innertext = "paste it into the notepad and save it as htm. The effect is-12-29 ";
O_myselectex.options.appendchild (o_option );
*/
If (oo. xmlsrc ){
Try {/*
VaR xml = eval (oo. xmlsrc );
VaR xmlnode = oo. xmlnode;
XML. s
*/
} Catch (e ){}
}
Document. Body. appendchild (o_myselectex );
O_myselectex.focus ();
O_myselectex.attachevent ("onblur", function (){
VaR es = event. srcelement;
// If a project exists in the SELECT statement, the value of the updated span is the value of the currently selected project.
If (ES. Options. Length) {oo. innertext = es. Options [es. selectedindex]. innertext ;}
Es. style. Visibility = "hidden ";
OO. style. Visibility = "visible ";
Es. removenode (true );
}
);
}
}
If (EXT = "textex "){
VaR o_mytextex = Document. getelementbyid ("_ mytextex ");
If (! O_mytextex ){
O_mytextex = Document. createelement ("input ");
O_mytextex.id = "_ mytextex ";
O_mytextex.type = "text ";
O_mytextex.style.position = "absolute ";
O_mytex.style.top = oo. offsettop;
O_mytextex.style.pixelleft = oo. offsetleft
O_mytex.style.width = oo. offsetwidth;
O_mytextex.style.visibility = "visible ";
OO. style. Visibility = "hidden ";
O_mytextex.value = oo. innertext;
Document. Body. appendchild (o_mytextex );
O_mytextex.focus ();
O_mytextex.select ();
O_mytextex.attachevent ("onblur", function (){
VaR es = event. srcelement;
OO. innertext = es. value;
Es. style. Visibility = "hidden ";
OO. style. Visibility = "visible ";
Es. removenode (true );
}
);
}
}
}
);
}
}
}
Myex. INIT ();
// Configure //---------------------------------------------------------------------------------------------------------------
Instance application:
// Configure //---------------------------------------------------------------------------------------------------------------
<HTML>
<Head>
<Title> myex demo </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<SCRIPT>
// Var xml = f. xmldom ("http: // 127.0.0.1/user. xml ")
</SCRIPT>
</Head>
<Body>
<Span myex = "selectex" xmlsrc = "XML" xmlnode = "// root/"> paste it into the notepad and save it as htm. The effect is-12-29. </span>
<Span> paste it to the notepad and save it as htm. The effect is-12-29. </span> <br>
<Span myex = "selectex"> paste it to the notepad and save it as htm. The effect is-12-29. </span>
<Span myex = "selectex"> paste it to the notepad and save it as htm. The effect is-12-29. </span> <br>
<Span myex = "textex"> paste it to the notepad and save it as htm. The effect is-12-29. </span>
</Body>
<SCRIPT src = "myex. js"> </SCRIPT>
</Html>