首页->控件应用->漂亮实用的自定义对话框源码及Demo>>Com.EEShou.Www.TreeControl/obj/Debug/Com.EEShou.Www.TreeControl.js.TreeControlsDialogBox.js>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:漂亮实用的自定义对话框源码及Demo
当前文件:
DialogExample/Com.EEShou.Www.TreeControl/obj/Debug/Com.EEShou.Www.TreeControl.js.TreeControlsDialogBox.js[5K,2009-6-12 11:38:49],打开代码结构图
DialogExample/Com.EEShou.Www.TreeControl/obj/Debug/Com.EEShou.Www.TreeControl.js.TreeControlsDialogBox.js[5K,2009-6-12 11:38:49],打开代码结构图1///////////////////////////////////////////////////////////////////// 2
//// //// 3
//// TreeDialogBoxControls //// 4
//// Namespace: TreeControls.js.TreeControlsDialogBox.js //// 5
//// CreateName: Tree //// 6
//// Email: treeyh@126.com //// 7
//// Version: 1.0 bate4 //// 8
//// CreateDate: 2008-2-18 //// 9
//// //// 10
///////////////////////////////////////////////////////////////////// 11
12
13
/* 14
Remark: 1 : document.documentElement.offsetWidth - document.body.clientWidth = scroll.width; 15
*/ 16
17
/*ShowPage*/ 18
function TreeDialogBoxShowMsg(_sMsg) 19
{ 20
TreeControls_ShowBackGround(); 21
22
Tree.$('TreeDialogBoxTable_Table_MsgTd').innerHTML = "<lable id='TreeDialogBoxTable_Table_MsgLb' name='TreeDialogBoxTable_Table_MsgLb'>"+_sMsg+"</lable>"; 23
24
var selectControls = document.getElementsByTagName("select"); 25
for(var i=0;i<selectControls.length;i++) 26
{ 27
selectControls[i]['style']['visibility']="hidden"; 28
} 29
30
var obackGround = Tree.$('TreeOverlayBackgroundDiv'); 31
32
obackGround.style.display="block"; 33
obackGround.style.height = Tree.docHeight(); 34
obackGround.style.width = Tree.docWidth(); 35
36
Tree.$('TreeDialogBoxDiv')['style']['display']="block"; 37
38
TreeDialogBoxmiddle("TreeDialogBoxDiv"); 39
40
iTree_DialogBox_scrolltop = parseInt(document.body.scrollTop); 41
iTree_DialogBox_scrollleft = parseInt(document.body.scrollLeft); 42
} 43
44
/*HiddenMsg*/ 45
function TreeDialogBoxHiddenMsg() 46
{ 47
Tree.$('TreeOverlayBackgroundDiv')['style']['display']="none"; 48
Tree.$('TreeDialogBoxDiv')['style']['display']="none"; 49
50
window.onscroll = null; 51
52
var selectControls = document.getElementsByTagName("select"); 53
for(var i=0;i<selectControls.length;i++) 54
{ 55
selectControls[i]['style']['visibility']="visible"; 56
} 57
} 58
59
/*window.onscroll*/ 60
function TreeDialogBoxOnscroll() 61
{ 62
var t = document.body.scrollTop; 63
var l = document.body.scrollLeft; 64
var oDialogBoxDiv = Tree.$('TreeDialogBoxDiv'); 65
66
oDialogBoxDiv.style.top = parseInt(oDialogBoxDiv.style.top) + (t - iTree_DialogBox_scrolltop); 67
oDialogBoxDiv.style.left = parseInt(oDialogBoxDiv.style.top) + (l - iTree_DialogBox_scrollleft); 68
} 69
70
/*Msgmiddle*/ 71
function TreeDialogBoxmiddle(_sId) 72
{ 73
var sClientWidth = parseInt(TreeClientWidth()); 74
var sClientHeight = parseInt(TreeClientHeight()); 75
var sScrollTop = document.documentElement.scrollTop; 76
77
Tree.$(_sId)['style']['position'] = "absolute"; 78
Tree.$(_sId)['style']['left'] = ((sClientWidth / 2) - 400/2)+"px"; 79
80
var sTop = (sClientHeight / 2) - 206 / 2; 81
Tree.$(_sId)['style']['top'] = (sScrollTop > 0 ? ((sClientHeight / 2) - 206 / 2 + sScrollTop) : sTop )+"px"; 82
} 83
84
/*MoveTreeDialogBox*/ 85
function TreeDialogBoxmoveStart(eve) 86
{ 87
var oBox = Tree.$('TreeDialogBoxDiv'); 88
89
var oTop = oBox.style.top; 90
var oLeft = oBox.style.left; 91
92
var tempx = eve.clientX + document.body.scrollLeft; 93
var tempy = eve.clientY + document.body.scrollTop; 94
95
iTree_DialogBox_excursionX = parseInt(tempx) - parseInt(oLeft); 96
iTree_DialogBox_excursionY = parseInt(tempy) - parseInt(oTop); 97
98
//oBox.setCapture(); 99
100
Tree.addEvent(oBox, 'mousemove', TreeDialogBoxmousemove); 101
Tree.addEvent(oBox, 'mouseup', TreeDialogBoxMouseup); 102
// oBox.onmousemove = TreeDialogBoxmousemove; 103
// oBox.onmouseup = TreeDialogBoxMouseup; 104
} 105
106
function TreeDialogBoxmousemove() 107
{ 108
var eve = window.event ? window.event : event; 109
var tempmousex = eve.clientX + document.body.scrollLeft; 110
var tempmousey = eve.clientY + document.body.scrollTop; 111
112
Tree.$("TreeDialogBoxDiv").style.top = parseInt(tempmousey) - iTree_DialogBox_excursionY; 113
Tree.$("TreeDialogBoxDiv").style.left = parseInt(tempmousex) - iTree_DialogBox_excursionX; 114
} 115
116
/*MoveTreeDialogBox*/ 117
function TreeDialogBoxMouseup() 118
{ 119
var oBox = Tree.$("TreeDialogBoxDiv"); 120
var iTop = parseInt(oBox.style.top); 121
var iLeft = parseInt(oBox.style.left); 122
123
if(iTop < 0) 124
{ 125
oBox.style.top = 0; 126
} 127
else if(iTop > iTree_DialogBox_MoveMaxHeight-2) 128
{ 129
oBox.style.top = iTree_DialogBox_MoveMaxHeight-2; 130
} 131
132
if(iLeft < 0 ) 133
{ 134
oBox.style.left = 0; 135
} 136
else if(iLeft > iTree_DialogBox_MoveMaxWidth) 137
{ 138
oBox.style.left = iTree_DialogBox_MoveMaxWidth; 139
} 140
141
//oBox.releaseCapture(); 142
Tree.removeEvent(oBox, 'mousemove', TreeDialogBoxmousemove); 143
Tree.removeEvent(oBox, 'mouseup', TreeDialogBoxMouseup); 144
// oTreeDialogBox.onmousemove = null; 145
// oTreeDialogBox.onmouseup = null; 146
} 147
148
149
/*PromptModeText*/ 150
function TreeDialogBoxInputTextOnFocus(inputtext) 151
{ 152
if(inputtext.value == inputtext.defaultValue) 153
{ 154
inputtext.value = ""; 155
inputtext.select(); 156
} 157
} 158
159
function TreeDialogBoxInputTextOnBlur(inputtext) 160
{ 161
if(inputtext.value == "") 162
{ 163
inputtext.value = inputtext.defaultValue; 164
} 165
}





Remark: 1 : document.documentElement.offsetWidth - document.body.clientWidth = scroll.width;


}