Samuel Learning
聯(lián)系
管理
文章分類
(203)
01 ASP/HTML(6)
02 Script/CSS(16)
03 C/C++
04 XML(4)
05 微軟編程(26)
06 J2EE(60)
09 Linux(14)
10 Database(27)
11 報(bào)表打印
12 打包安裝(1)
13 模式重構(gòu)(2)
14 系統(tǒng)架構(gòu)
15 敏捷開(kāi)發(fā)(11)
16 案例分析(30)
17 Workflow(1)
18 配置管理(1)
19 項(xiàng)目管理
20 英語(yǔ)(4)
新聞分類
(52)
CXF學(xué)習(xí)
Hibernate學(xué)習(xí)(1)
iBatis學(xué)習(xí)(16)
Struts1學(xué)習(xí)(1)
Struts2學(xué)習(xí)(34)
.NET資源
adxmenu
C# Open Source
DNN Directory
M2Land
Windows Form FAQ
中國(guó)DNN
中國(guó)DNN聯(lián)盟
Ajax
DoJo
GWT
JQuery
jquery autocomplete
jquery flexgrid
JQuery Form
jquery masked input
JQuery UI
jquery validation
Jquery 圖表
jquery報(bào)表
jquery插件集合
Qooxdoo
Tibco GI
YUI
YUI-EXT
ZeroKode
Java開(kāi)源
ABLE
Agile Tao
Ajax4JSF
Alfresco
AppFuse
Compiere
Equinox
Findbugs
Geronimo
Grails
Harmony
Hibernate論壇
JAG
Java開(kāi)源大全
Java視線論壇
jBPM工作流
JSFTutorials
Nereide ERP
Ofbiz ERP
Opentaps ERP
operamasks
Petstore
Prototype.js
RIFE
Runa
SpringSide
Struts Menu
Sun Glassfish
Trails
YUI4JSF
滿江紅
Mobile
Sencha
WEB資源
DHTML中心
DHTML參考手冊(cè)
DHTML文檔
EclipsePlugin
Firebug
GRO Clinux
jMaki
JSTL文檔
LoadIcon
Openlaszlo
Struts Menu 展示
Web Test Tools
WebCtrs
Webdeveloper
中國(guó)RIA開(kāi)發(fā)者論壇
Workflow
E-Workflow
JBPM
OpenWFE
OSWorkflow
WFMC
Workflow Research
其他連接
confach
CPP
ejay
Giovanni
丹佛
交大e-learning
交大研究生院
可惡的貓
天天@blog
我的相冊(cè)
阿飛
大牛人
32篇JBPM
David.Turing
HongSoft@業(yè)務(wù)集成
Joel
Koen Aers
Martinfowler
Raible Matt
Raible Wiki
Scott W.Ambler
Tom Baeyens
Uncle Bob
一個(gè)世界在等待
子在川上曰
小布老師
小明
差沙
徐昊
江南白衣
汪博士
汪小金
銀狐999
開(kāi)源軟件
2Bizbox ERP
CompiereCRM&ERP
EGW
Vtiger CRM
webERP
敏捷
Canoo
Cruisecontrol
DBUnit
EL4Ant
Extreme Programming
Fit
Fitnesse
JFrog
Liquibase
Maven
MockObjects
Selenium
Squish
xpairtise
XPlanner
XProgramming
敏捷聯(lián)盟
數(shù)據(jù)庫(kù)
Oracle 中國(guó)
Oracle-ERP
Oracle在線社區(qū)
未歸類
Aquarius Orm Studio
mambo建站系統(tǒng)
Oracle產(chǎn)品下載
遠(yuǎn)程同步管理工具Capivara
經(jīng)典框架
Apache Shale
formdef-struts
FreeMarker 主頁(yè)
JBoss Seam
JSF 中心
JSF 入門(mén)應(yīng)用
JSF中國(guó)
MyFaces官方
Spring 社區(qū)
Spring專業(yè)網(wǎng)站
Spring中文論壇
Spring參考手冊(cè)
Spring官方網(wǎng)站
strecks-struts
Struts1
Struts2
Struts-layout
StrutsWiKi
Tapestry WIKI
Tapestry 官方
Tapestry4開(kāi)發(fā)指南
Tapestry中文文檔
Webwork2文檔
Wicket
網(wǎng)絡(luò)教程
Laliluna
RoseIndia
Sang Shin
Visualbuilder
著名站點(diǎn)
Buildix
Dev2Dev
IBM dev中國(guó)
InfoQ
ITPub
Java Eye
Java Research
JavaRead
JavaWorldTW
Matrix
PHP100
PHPX
SpringSideWiKi
TheServerSide
TWPHP
中國(guó)工作流論壇
項(xiàng)目管理
管理人網(wǎng)
最新評(píng)論
View Post
用層模擬對(duì)話框
<
HTML
><
HEAD
>
<
META
content
="MSHTML 6.00.2800.1586"
name
=GENERATOR
></
HEAD
>
<
BODY
><
INPUT
onclick
="sAlert('測(cè)試效果<br/>還可以直接書(shū)寫(xiě)HTML代碼 <br/>© 2006');"
type
=button
value
=點(diǎn)擊這里
>
<
SCRIPT
language
=javascript
type
=text/javascript
>
//
Author:Daviv
//
Blog:<a href="<a href="" target="_blank">http</a>" target="_blank"><a href="" target="_blank">http://</a></a>
//
Date:2006-10-28
function
sAlert(str)
{
var
msgw,msgh,bordercolor;
msgw
=
400
;
//
提示窗口的寬度
msgh
=
100
;
//
提示窗口的高度
bordercolor
=
"
#336699
"
;
//
提示窗口的邊框顏色
titlecolor
=
"
#99CCFF
"
;
//
提示窗口的標(biāo)題顏色
var
sWidth,sHeight;
sWidth
=
document.body.offsetWidth;
sHeight
=
document.body.offsetHeight;
var
bgObj
=
document.createElement(
"
div
"
);
bgObj.setAttribute('id','bgDiv');
bgObj.style.position
=
"
absolute
"
;
bgObj.style.top
=
"
0
"
;
bgObj.style.background
=
"
#777
"
;
bgObj.style.filter
=
"
progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75
"
;
bgObj.style.opacity
=
"
0.6
"
;
bgObj.style.left
=
"
0
"
;
bgObj.style.width
=
sWidth
+
"
px
"
;
bgObj.style.height
=
sHeight
+
"
px
"
;
document.body.appendChild(bgObj);
var
msgObj
=
document.createElement(
"
div
"
)
msgObj.setAttribute(
"
id
"
,
"
msgDiv
"
);
msgObj.setAttribute(
"
align
"
,
"
center
"
);
msgObj.style.position
=
"
absolute
"
;
msgObj.style.background
=
"
white
"
;
msgObj.style.font
=
"
12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif
"
;
msgObj.style.border
=
"
1px solid
"
+
bordercolor;
msgObj.style.width
=
msgw
+
"
px
"
;
msgObj.style.height
=
msgh
+
"
px
"
;
msgObj.style.top
=
(document.documentElement.scrollTop
+
(sHeight
-
msgh)
/
2
)
+
"
px
"
;
msgObj.style.left
=
(sWidth
-
msgw)
/
2
+
"
px
"
;
var
title
=
document.createElement(
"
h4
"
);
title.setAttribute(
"
id
"
,
"
msgTitle
"
);
title.setAttribute(
"
align
"
,
"
right
"
);
title.style.margin
=
"
0
"
;
title.style.padding
=
"
3px
"
;
title.style.background
=
bordercolor;
title.style.filter
=
"
progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);
"
;
title.style.opacity
=
"
0.75
"
;
title.style.border
=
"
1px solid
"
+
bordercolor;
title.style.height
=
"
18px
"
;
title.style.font
=
"
12px Verdana, Geneva, Arial, Helvetica, sans-serif
"
;
title.style.color
=
"
white
"
;
title.style.cursor
=
"
pointer
"
;
title.innerHTML
=
"
關(guān)閉
"
;
title.onclick
=
function
()
{
document.body.removeChild(bgObj);
document.getElementById(
"
msgDiv
"
).removeChild(title);
document.body.removeChild(msgObj);
}
document.body.appendChild(msgObj);
document.getElementById(
"
msgDiv
"
).appendChild(title);
var
txt
=
document.createElement(
"
p
"
);
txt.style.margin
=
"
1em 0
"
txt.setAttribute(
"
id
"
,
"
msgTxt
"
);
txt.innerHTML
=
str;
document.getElementById(
"
msgDiv
"
).appendChild(txt);
}
</
SCRIPT
>
</
BODY
></
HTML
>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
>
<
meta
http-equiv
="Content-Type"
content
="text/html; charset=gb2312"
/>
<
title
>
自定義彈出對(duì)話框
</
title
>
<
script
language
="javascript"
type
="text/javascript"
>
var
Class
=
{
create:
function
()
{
return
function
()
{
return
this
.init.apply(
this
, arguments);
}
}
}
;
Object.extend
=
function
(dest, source)
{
for
(prop
in
source)
{
dest[prop]
=
source[prop];
}
return
dest;
}
Object.extend(String.prototype,
{
Trim :
function
()
{
return
this
.replace(
/
(
^
\s
*
)
|
(\s
*
$)
/
g,
""
);
}
,
lTrim :
function
()
{
return
this
.replace(
/
(
^
\s
*
)
/
g,
""
);
}
,
rTrim :
function
()
{
return
this
.replace(
/
(\s
*
$)
/
g,
""
);
}
}
)
Function.prototype.bind
=
function
()
{
var
__method
=
this
, args
=
$A(arguments), object
=
args.shift();
return
function
()
{
return
__method.apply(object, args.concat($A(arguments)));
}
}
function
$(id)
{
return
document.getElementById(id);
}
var
$A
=
function
(iterable)
{
if
(
!
iterable)
return
[];
if
(iterable.toArray)
{
return
iterable.toArray();
}
else
{
var
results
=
[];
for
(
var
i
=
0
; i
<
iterable.length; i
++
)
results.push(iterable[i]);
return
results;
}
}
function
OKTag(a, b, c, value)
{
alert(
"
arguments : \n
"
+
a
+
"
:
"
+
b
+
"
:
"
+
c
+
"
; \n value =
"
+
value);
//
Todo
}
var
CustomDlg
=
Class.create();
CustomDlg.prototype
=
{
init:
function
(id, callback_func)
{
if
(
!
this
._dlg)
{
this
._bShowStatus
=
false
;
this
._dlg
=
$(id);
this
._form
=
this
._dlg.getElementsByTagName(
"
form
"
)[
0
];
this
._inputObj
=
this
._form.elements[
"
content
"
];
this
._OKBtn
=
this
._form.elements[
"
OK
"
];
this
._ResetBtn
=
this
._form.elements[
"
reset
"
];
this
._closeBtn
=
$(
"
CustomDlg_Close
"
);
this
._DlgTitle
=
$(
"
CustomDlg_TitleBar
"
);
this
._form.onsubmit
=
function
(evt)
{
//
OK Event
if
(callback_func)
{
var
rtnValue
=
this
._getValue();
this
._close();
callback_func(rtnValue);
}
return
false
;
//
防止提交到服務(wù)器
}
.bind(
this
);
this
._ResetBtn.onclick
=
function
(evt)
{
//
Reset Event
this
._inputObj.focus();
}
.bind(
this
);
this
._closeBtn.onclick
=
function
(evt)
{
//
Destory Event
this
._close();
}
.bind(
this
);
window.onresize
=
function
(evt)
{
//
Change Window Event
if
(
"
none
"
!=
this
._dlg.style.display)
this
._show();
}
.bind(
this
);
this
._dlg.onselectstart
=
function
(evt)
{
if
(
!
evt) evt
=
window.event;
var
srcElem
=
evt.target
||
evt.srcElement;
if
(srcElem
!=
this
._inputObj)
return
false
;
}
.bind(
this
);
this
._DlgTitle.style.cursor
=
"
default
"
;
this
._DlgTitle.onmousedown
=
function
(obj, limit, evt)
{
//
Drag Event
this
._fDragging(obj, evt, limit);
}
.bind(
this
,
this
._dlg,
false
);
//
注意參數(shù)傳遞方式,也可以寫(xiě)成下面這樣
/**/
/*
DlgTitle.onmousedown = function(evt) {
this._fDragging(this._dlg, evt, false);
}.bind(this);
*/
}
if
(
!
this
._bShowStatus)
this
._show();
}
,
_show:
function
()
{
this
._bShowStatus
=
true
;
this
._dlg.style.visibility
=
"
hidden
"
;
this
._dlg.style.display
=
""
;
var
dLeft
=
((document.documentElement.clientWidth
-
this
._dlg.clientWidth)
/
2
)
+
document.documentElement.scrollLeft;
var
dTop
=
((document.documentElement.clientHeight
-
this
._dlg.clientHeight)
/
2
)
+
document.documentElement.scrollTop;
if
(dTop
<
0
||
dLeft
<
0
)
{
this
._inputObj.blur();
return
false
;
}
this
._dlg.style.left
=
dLeft
+
"
px
"
;
this
._dlg.style.top
=
dTop
+
"
px
"
;
this
._dlg.style.visibility
=
"
visible
"
;
this
._inputObj.focus();
if
(document.addEventListener)
{
document.addEventListener('keydown',
this
._keypress.bind(
this
),
true
);
}
else
if
(document.attachEvent)
{
document.attachEvent('onkeydown',
this
._keypress.bind(
this
));
}
}
,
_close:
function
()
{
this
._bShowStatus
=
false
;
this
._dlg.style.display
=
"
none
"
;
this
._dlg.style.visibility
=
"
hidden
"
;
this
._inputObj.value
=
""
;
this
._inputObj.blur();
if
(document.addEventListener)
{
document.removeEventListener('keydown',
this
._keypress.bind(
this
),
true
);
}
else
if
(document.attachEvent)
{
document.detachEvent('onkeydown',
this
._keypress.bind(
this
));
}
}
,
_reset:
function
()
{
//
this._inputObj.value = "";
this
._inputObj.focus();
//
IE 的一個(gè)Bug, 不能自動(dòng)聚焦
}
,
_keypress:
function
(evt)
{
if
(
!
evt) evt
=
window.event;
switch
(evt.keyCode)
{
case
27
:
this
._close();
break
;
//
Esc Key be press down
case
13
:
this
._OKBtn.click();
break
;
//
Enter Key be press down
default
:
break
;
}
}
,
_getValue:
function
()
{
return
this
._inputObj.value;
}
,
_fDragging:
function
(obj, evt, limit)
{
if
(
!
evt) evt
=
window.event;
var
x
=
parseInt(obj.style.left);
var
y
=
parseInt(obj.style.top);
var
x_
=
evt.clientX
-
x;
var
y_
=
evt.clientY
-
y;
if
(document.addEventListener)
{
document.addEventListener('mousemove', inFmove,
true
);
document.addEventListener('mouseup', inFup,
true
);
}
else
if
(document.attachEvent)
{
document.attachEvent('onmousemove', inFmove);
document.attachEvent('onmouseup', inFup);
}
inFstop(evt);
inFabort(evt);
function
inFmove(evt)
{
if
(
!
evt) evt
=
window.event;
if
(limit)
{
var
op
=
obj.parentNode;
var
opX
=
parseInt(op.style.left);
var
opY
=
parseInt(op.style.top);
if
((evt.clientX
-
x_)
<
0
)
return
false
;
else
if
((evt.clientX
-
x_
+
obj.offsetWidth
+
opX)
>
(opX
+
op.offsetWidth))
return
false
;
if
(evt.clientY
-
y_
<
0
)
return
false
;
else
if
((evt.clientY
-
y_
+
obj.offsetHeight
+
opY)
>
(opY
+
op.offsetHeight))
return
false
;
//
status=e.clientY-y_;
}
obj.style.left
=
evt.clientX
-
x_
+
'px';
obj.style.top
=
evt.clientY
-
y_
+
'px';
inFstop(evt);
}
function
inFup(evt)
{
if
(
!
evt) evt
=
window.event;
if
(document.removeEventListener)
{
document.removeEventListener('mousemove', inFmove,
true
);
document.removeEventListener('mouseup', inFup,
true
);
}
else
if
(document.detachEvent)
{
document.detachEvent('onmousemove', inFmove);
document.detachEvent('onmouseup', inFup);
}
inFstop(evt);
}
function
inFstop(evt)
{
if
(evt.stopPropagation)
return
evt.stopPropagation();
else
return
evt.cancelBubble
=
true
;
}
function
inFabort(evt)
{
if
(evt.preventDefault)
return
evt.preventDefault();
else
return
evt.returnValue
=
false
;
}
}
}
</
script
>
</
head
>
<
body
>
<
div
style
="display:block; position:absolute;width:100px;height:25px;top:100px;"
>
<
a
onclick
="new CustomDlg('CustomDlg', OKTag.bind(this, '1', '2', '3'))"
style
="cursor:pointer"
>
點(diǎn)擊彈出自定義對(duì)話框
</
a
>
</
div
>
<
div
style
="display:block; position:absolute;width:100px;height:25px;top:700px;"
>
<
a
onclick
="new CustomDlg('CustomDlg', OKTag.bind(this, 'a', 'b', 'c'))"
style
="cursor:pointer"
>
點(diǎn)擊彈出自定義對(duì)話框
</
a
>
</
div
>
<
div
style
="display:block; position:absolute;width:100px;height:25px;top:1200px;"
>
<
a
onclick
="new CustomDlg('CustomDlg', OKTag.bind(this, '你', '好', '嗎'))"
style
="cursor:pointer"
>
點(diǎn)擊彈出自定義對(duì)話框
</
a
>
<
a
name
="abc"
href
="#abc"
>
abcanchor
</
a
>
</
div
>
<
div
id
="CustomDlg"
style
="display:none"
>
<
div
class
="TitleBar"
id
="CustomDlg_TitleBar"
>
請(qǐng)輸入標(biāo)簽
<
span
id
="CustomDlg_Close"
>
X
</
span
></
div
>
<
form
onsubmit
="return false;"
method
="get"
action
="#"
>
<
div
class
="Content"
>
<
p
>
標(biāo)簽與標(biāo)簽之間用空隔分割,單個(gè)標(biāo)簽不能超過(guò)30字符:
</
p
>
<
input
class
="Input"
type
="text"
name
="content"
maxlength
="255"
size
="30"
/>
<
div
>
<
input
type
="submit"
name
="OK"
class
="Btn"
value
="確 定"
/>
<
input
type
="reset"
name
="reset"
class
="Btn"
value
="重 寫(xiě)"
/>
</
div
>
</
div
>
</
form
>
</
div
>
<
style
type
="text/css"
>
#CustomDlg
{
}
{
position
:
absolute
;
background
:
#f1f1f1
;
width
:
230px
;
font-size
:
12px
;
text-align
:
left
;
border
:
1px solid #ccc
;
}
#CustomDlg .TitleBar
{
}
{
background
:
#369
;
text-align
:
left
;
text-indent
:
0.5em
;
height
:
20px
;
line-height
:
20px
;
color
:
#FFF
;
-moz-user-select
:
none
;
-khtml-user-select
:
none
;
user-select
:
none
;
}
#CustomDlg .TitleBar span
{
}
{
float
:
right
;
margin-top
:
-20px
;
margin-right
:
4px
;
cursor
:
pointer
;
display
:
block
;
font-weight
:
bold
;
font-family
:
Arial, Helvetica, sans-serif
;
}
#CustomDlg form
{
}
{
padding
:
0px
;
margin
:
6px
;
}
#CustomDlg .Content
{
}
{
text-align
:
center
;
}
#CustomDlg .Content p
{
}
{
padding
:
5px 5px 2px 5px
;
margin
:
0px
;
text-align
:
left
;
-moz-user-select
:
none
;
-khtml-user-select
:
none
;
user-select
:
none
;
}
#CustomDlg .Content .Input
{
}
{
width
:
210px
;
height
:
18px
;
line-height
:
18px
;
}
#CustomDlg .Btn
{
}
{
margin
:
2px 6px
;
border-bottom
:
groove 1px #000000
;
border-right
:
groove 1px #000000
;
width
:
64px
;
height
:
22px
;
line-height
:
18px
;
cursor
:
pointer
;
}
</
style
>
</
body
>
</
html
>
posted on 2008-01-18 16:44
MingIsMe
閱讀(210)
評(píng)論(0)
編輯
收藏
所屬分類:
02 Script/CSS
Powered by:
BlogJava
Copyright © MingIsMe
主站蜘蛛池模板:
左云县
|
太白县
|
台南县
|
黔西县
|
南部县
|
鄂尔多斯市
|
滨州市
|
古浪县
|
上犹县
|
日照市
|
温泉县
|
乌苏市
|
渭源县
|
汾西县
|
互助
|
兴海县
|
宁河县
|
额敏县
|
津南区
|
白银市
|
龙里县
|
密云县
|
上林县
|
金乡县
|
阳城县
|
嘉义市
|
长沙市
|
辛集市
|
宾阳县
|
静海县
|
武鸣县
|
本溪
|
禹城市
|
荣昌县
|
望都县
|
武夷山市
|
SHOW
|
军事
|
仪征市
|
铅山县
|
凤阳县
|