?? tv20.js
字號:
document.all[i].insertAdjacentHTML( "AfterBegin" , str ) ;
break
}
}
else
document.all( "tv_panel_" + this.parent.id ).insertAdjacentHTML( "BeforeEnd" , str ) ;
//alert("before id " + this.id);
for( m = 0 ; m < this.subitems.length ; m ++ ) {
// alert("after id " + this.id);
if( this.subitems[ m ] != null ) {
userstack.put( m ) ;
this.subitems[ m ].show() ;
m = userstack.get() ;
}
}
}
function nodeitem_refresh() {
str = "<table border='0' cellspacing='0' cellpadding='0'><tr><td>" ;
str_f = "" ;
for( j = this.parent ; j != null ; j = j.parent ) {
if( j.status.substring( 0 , 1 ) == 1 )
str_f = "<img src = '" + treeview_box_0_none + "' align='absmiddle'>" + str_f ;
else
str_f = "<img src = '" + treeview_box_0_line + "' align='absmiddle'>" + str_f ;
}
str = str + str_f ;
str += "<img id = 'box" + this.id + "' nodeid = '" + this.id + "' src = '" ;
switch( this.status.substring( 0 , 2 ) ) {
case "10" : str += treeview_box_1_none ; break ;
case "11" : str += treeview_box_1_close ; break ;
case "12" : str += treeview_box_1_open ; break ;
case "20" : str += treeview_box_2_none ; break ;
case "21" : str += treeview_box_2_close ; break ;
case "22" : str += treeview_box_2_open ; break ;
}
str += "' align='absmiddle' onclick='box_on_click(this)'>" ;
if( this.img == "" )
str += this.img ;
else
str += "<img src = '" + this.img + "' align='absmiddle' width='16' height='16'>" ;
str += "</td><td><table border='0' cellspacing='1' cellpadding='1' style='font-size:9pt; color:#333333' id='lablePanel" + this.id + "'><tr><td ondblclick = 'lable_on_dblclick(" + this.id + ")' onclick='lable_on_click(" + this.id + ")' style='cursor:hand' id='f_lablePanel" + this.id + "' nowrap>" + this.lable + "</td></tr></table></td></tr></table>" ;
document.all( "preface" + this.id ).innerHTML = str ;
document.all( "tv_panel_" + this.id ).innerHTML = "" ;
for( m = 0 ; m < this.subitems.length ; m ++ )
if( this.subitems[ m ] != null ) {
userstack.put( m ) ;
this.subitems[ m ].show() ;
m = userstack.get() ;
}
}
function nodeitem_remove() {
pparent = this.parent ;
if( pparent == null ) {
removenodeitem( this.id ) ;
for(var i in document.all){
if (document.all[i].tagName == "BODY")
{
document.all[i].innerHTML = "" ;
break
}
}
return ;
}
lastsubitem = null ;
for( i = 0 ; i < pparent.subitems.length ; i ++ )
if( pparent.subitems[ i ] != null )
if ( pparent.subitems[ i ] == this )
pparent.subitems[ i ] = null ;
else
lastsubitem = pparent.subitems[ i ] ;
pparent.maxsubitem = lastsubitem ;
if( lastsubitem == null )
pparent.status = pparent.status.substring( 0 , 1 ) + "0" + pparent.status.substring( 2 , 3 ) ;
else
pparent.maxsubitem.status = "1" + pparent.maxsubitem.status.substring( 1 , 3 ) ;
removenodeitem( this.id ) ;
//added by msb for move up/down
arrTemp = new Array();
j = 0;
for ( i=0; i<pparent.subitems.length; i++ ) {
if ( pparent.subitems[i] != null ) {
arrTemp[j] = pparent.subitems[i];
j++;
}
}
this.parent.subitems = arrTemp;
//end added
pparent.refresh() ;
//tv_topnodeitem.refresh() ;
}
function removenodeitem( id ) {
curitem = nodeitems[ id ] ;
nodeitems[ id ] = null ;
for( m = 0 ; m < curitem.subitems.length ; m ++ )
if( curitem.subitems[ m ] != null ) {
userstack.put( m ) ;
removenodeitem( curitem.subitems[ m ].id ) ;
m = userstack.get() ;
}
}
function nodeitem_boxclick() {
if( this.status.substring( 1 ,2 ) == "0" )
return ;
if( this.status.substring( 1 ,2 ) == "1" )
this.open() ;
else
this.close() ;
}
function nodeitem_close() {
this.status = this.status.substring( 0 , 1 ) + "1" + this.status.substring( 2 , 3 ) ;
document.all( "tv_panel_" + this.id ).style.display = "none" ;
eval( "document.all( 'box' + this.id ).src = treeview_box_" + this.status.substring( 0 , 1 ) +"_close" ) ;
}
function nodeitem_open() {
this.status = this.status.substring( 0 , 1 ) + "2" + this.status.substring( 2 , 3 ) ;
document.all( "tv_panel_" + this.id ).style.display = "" ;
eval( "document.all( 'box' + this.id ).src = treeview_box_" + this.status.substring( 0 , 1 ) +"_open" ) ;
}
//added by msb for the move up/down
nodeitem.prototype.moveUp = nodeitem_moveUp;
nodeitem.prototype.moveDown = nodeitem_moveDown;
//end added
nodeitem.prototype.show = nodeitem_show ;
nodeitem.prototype.refresh = nodeitem_refresh ;
nodeitem.prototype.boxclick = nodeitem_boxclick ;
nodeitem.prototype.close = nodeitem_close ;
nodeitem.prototype.open = nodeitem_open ;
nodeitem.prototype.remove = nodeitem_remove ;
nodeitem.prototype.setTag = nodeitem_setTag ;
nodeitem.prototype.getTag = nodeitem_getTag ;
//==========================================================
// Public Methods
//==========================================================
function showTV() {
tv_topnodeitem.show() ;
}
function findNode( key ) {
pppp = null;
for( i = 0 ; i < nodeitems.length ; i ++ ) {
if( nodeitems[ i ] != null ) {
if( nodeitems[ i ].key == key ) {
pppp = nodeitems[ i ] ;
}
}
}
return pppp ;
}
function addNode( parentkey , key , lable , img ) {
return new nodeitem( parentkey , key , lable , img ) ;
}
function deleteNode( key ) {
curNode = findNode( key ) ;
if( curNode == null )
return false ;
curNode.remove() ;
return true ;
}
//====== END ================
//===========================================================
// Events
//===========================================================
function box_on_click( obj ) {
nodeitems[ obj.nodeid ].boxclick() ;
}
tv_curlable = null ;
tv_curlable_f = null ;
function lable_on_click( id ) {
key = nodeitems[ id ].key ;
if( nodeitems[ id ].parent == null )
parentkey = "" ;
else
parentkey = nodeitems[ id ].parent.key ;
if( tv_curlable != null ) {
tv_curlable.bgColor = "transparent" ;
tv_curlable.style.color = "#333333" ;
tv_curlable_f.bgColor = "transparent" ;
}
tv_curlable = document.all("lablePanel"+id) ;
tv_curlable.bgColor = "#000000" ;
tv_curlable.style.color = "#FFFFFF" ;
tv_curlable_f = document.all("f_lablePanel"+id) ;
tv_curlable_f.bgColor = "#888888" ;
for( i = 0 ; i < tv_listeners.length ; i ++ )
if( tv_listeners[ i ].type == "click" ) {
h = tv_listeners[ i ].handler ;
eval( h + "( '" + key + "' , '" + parentkey + "' ) ; " ) ;
}
}
function lable_on_dblclick( id ) {
key = nodeitems[ id ].key ;
if( nodeitems[ id ].parent == null )
parentkey = "" ;
else
parentkey = nodeitems[ id ].parent.key ;
if( tv_curlable != null ) {
tv_curlable.bgColor = "transparent" ;
tv_curlable.style.color = "#333333" ;
tv_curlable_f.bgColor = "transparent" ;
}
tv_curlable = document.all("lablePanel"+id) ;
tv_curlable.bgColor = "#000000" ;
tv_curlable.style.color = "#FFFFFF" ;
tv_curlable_f = document.all("f_lablePanel"+id) ;
tv_curlable_f.bgColor = "#888888" ;
for( i = 0 ; i < tv_listeners.length ; i ++ )
if( tv_listeners[ i ].type == "dblclick" ) {
h = tv_listeners[ i ].handler ;
eval( h + "( '" + key + "' , '" + parentkey + "' ) ; " ) ;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -