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 報表打印
12 打包安裝(1)
13 模式重構(gòu)(2)
14 系統(tǒng)架構(gòu)
15 敏捷開發(fā)(11)
16 案例分析(30)
17 Workflow(1)
18 配置管理(1)
19 項目管理
20 英語(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
中國DNN
中國DNN聯(lián)盟
Ajax
DoJo
GWT
JQuery
jquery autocomplete
jquery flexgrid
JQuery Form
jquery masked input
JQuery UI
jquery validation
Jquery 圖表
jquery報表
jquery插件集合
Qooxdoo
Tibco GI
YUI
YUI-EXT
ZeroKode
Java開源
ABLE
Agile Tao
Ajax4JSF
Alfresco
AppFuse
Compiere
Equinox
Findbugs
Geronimo
Grails
Harmony
Hibernate論壇
JAG
Java開源大全
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參考手冊
DHTML文檔
EclipsePlugin
Firebug
GRO Clinux
jMaki
JSTL文檔
LoadIcon
Openlaszlo
Struts Menu 展示
Web Test Tools
WebCtrs
Webdeveloper
中國RIA開發(fā)者論壇
Workflow
E-Workflow
JBPM
OpenWFE
OSWorkflow
WFMC
Workflow Research
其他連接
confach
CPP
ejay
Giovanni
丹佛
交大e-learning
交大研究生院
可惡的貓
天天@blog
我的相冊
阿飛
大牛人
32篇JBPM
David.Turing
HongSoft@業(yè)務(wù)集成
Joel
Koen Aers
Martinfowler
Raible Matt
Raible Wiki
Scott W.Ambler
Tom Baeyens
Uncle Bob
一個世界在等待
子在川上曰
小布老師
小明
差沙
徐昊
江南白衣
汪博士
汪小金
銀狐999
開源軟件
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ù)庫
Oracle 中國
Oracle-ERP
Oracle在線社區(qū)
未歸類
Aquarius Orm Studio
mambo建站系統(tǒng)
Oracle產(chǎn)品下載
遠(yuǎn)程同步管理工具Capivara
經(jīng)典框架
Apache Shale
formdef-struts
FreeMarker 主頁
JBoss Seam
JSF 中心
JSF 入門應(yīng)用
JSF中國
MyFaces官方
Spring 社區(qū)
Spring專業(yè)網(wǎng)站
Spring中文論壇
Spring參考手冊
Spring官方網(wǎng)站
strecks-struts
Struts1
Struts2
Struts-layout
StrutsWiKi
Tapestry WIKI
Tapestry 官方
Tapestry4開發(fā)指南
Tapestry中文文檔
Webwork2文檔
Wicket
網(wǎng)絡(luò)教程
Laliluna
RoseIndia
Sang Shin
Visualbuilder
著名站點(diǎn)
Buildix
Dev2Dev
IBM dev中國
InfoQ
ITPub
Java Eye
Java Research
JavaRead
JavaWorldTW
Matrix
PHP100
PHPX
SpringSideWiKi
TheServerSide
TWPHP
中國工作流論壇
項目管理
管理人網(wǎng)
最新評論
View Post
用層模擬彈出窗口
HTML
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
>
<
title
>
div彈出
</
title
>
<
META
http-equiv
=Content-Type
content
="text/html; charset=gb2312"
>
<
SCRIPT
src
="DivShow.js"
type
="text/javascript"
></
SCRIPT
>
</
head
>
<
body
>
<
div
id
="leftDiv"
style
="width: 800px; position: absolute; left: -410px; top: 100px; display:none;
border: solid 1px red;"
>
<
div
>
left
<
a
href
="javascript:void(0);"
onclick
="divHide('leftDiv','left','')"
>
close
</
a
></
div
>
<
div
style
="width:100%"
>
<
table
width
="100%"
border
="1"
>
<
tr
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
div
>
<
div
id
="middleDiv"
style
="width: 400px; position: absolute; display:none; border: solid 1px red;"
>
middle
<
a
href
="javascript:void(0);"
onclick
="divHide('middleDiv','center','')"
>
close
</
a
>
</
div
>
<
div
id
="rightDiv"
style
="width: 400px; position: absolute; right: 0px; top: 100px; display:none;
border: solid 1px red;"
>
<
a
href
="javascript:void(0);"
onclick
="divHide('rightDiv','right','speed:5000;')"
>
close
</
a
>
right
</
div
>
<
div
id
="jincai"
></
div
>
<
input
type
="button"
name
="left"
value
="left"
onclick
="divShow('leftDiv', 'left', 'speed: 1000;')"
/>
<
input
type
="button"
name
="middle"
value
="middle1"
onclick
="divShow('middleDiv', 'center', '');"
/>
<
input
type
="button"
name
="middle"
value
="middle2"
onclick
="divShow('middleDiv', 'center', 'Opacity:10;');"
/>
<
input
type
="button"
name
="middle"
value
="middle3"
onclick
="divShow('middleDiv', 'center', 'width:200px;heiGht:200px;');"
/>
<
input
type
="button"
name
="middle"
value
="middle4"
onclick
="divShow('middleDiv', 'center', 'left:10px;Top:10;');"
/>
<
input
type
="button"
name
="right"
value
="right"
onclick
="divShow('rightDiv', 'Right', 'speed:1000;');"
/>
</
body
>
</
html
>
Script
//
字符的trim()方法
String.prototype.trim
=
function
()
{
//
用正則表達(dá)式將前后空格
//
用空字符串替代。
return
this
.replace(
/
(
^
\s
*
)
|
(\s
*
$)
/
g,
""
);
}
//
驗證是否為數(shù)字
function
isNumber(oNum)
{
if
(
!
oNum)
return
false
;
var
strP
=/^
\d
+
(\.\d
+
)
?
$
/
;
if
(
!
strP.test(oNum))
return
false
;
try
{
if
(parseFloat(oNum)
!=
oNum)
return
false
;
}
catch
(ex)
{
return
false
;
}
return
true
;
}
//
***************************************頁面彈出DIV代碼_SHOW Felix 2007-12-07***************************************//
//
頁面跳出DIV
function
divShow(divId, showType, showProperty)
{
//
獲得目標(biāo)DIV
var
tagDiv
=
document.getElementById(divId);
if
(tagDiv
==
null
)
{
return
;
}
tagDiv.style.display
=
""
;
//
設(shè)置默認(rèn)屬性
var
divWidth
=
tagDiv.offsetWidth;
//
目標(biāo)DIV的寬度
var
divHeight
=
tagDiv.offsetHeight;
//
目標(biāo)DIV的高度
var
divLeft
=
(Math.max(document.documentElement.offsetWidth, document.body.scrollWidth)
-
divWidth)
/
2
;
//
目標(biāo)DIV左邊定位
var
divTop
=
(Math.max(document.documentElement.offsetHeight, document.body.scrollHeight)
-
divHeight)
/
2
;
//
目標(biāo)DIV頂端定位
var
bgOpacity
=
30
;
//
背景的透明度 0為全透明 100為不透明
var
scrollSpeed
=
100
;
//
從邊框滾動出來的DIV的滾出速度 單位:毫秒
//
讀取設(shè)置屬性
var
propertys
=
showProperty.split(';');
for
(
var
i
=
0
;i
<
propertys.length;i
++
)
{
var
property
=
propertys[i].trim().split(':');
if
(property.length
==
2
)
{
var
propertyValue
=
property[
1
].trim().replace(
"
px
"
,
""
);
if
(
!
isNumber(propertyValue))
{
return
;}
switch
(property[
0
].trim().toLowerCase())
{
case
"
width
"
:
divWidth
=
propertyValue;
break
;
case
"
height
"
:
divHeight
=
propertyValue;
break
;
case
"
left
"
:
divLeft
=
propertyValue;
break
;
case
"
top
"
:
divTop
=
propertyValue;
break
;
case
"
opacity
"
:
bgOpacity
=
propertyValue;
break
;
case
"
speed
"
:
scrollSpeed
=
propertyValue;
break
;
}
}
}
//
根據(jù)彈出類型,調(diào)用不同方法
switch
(showType.toLowerCase())
{
case
"
left
"
:
showLeftDiv(divId, divWidth
+
10
, scrollSpeed,
0
);
break
;
case
"
right
"
:
document.body.style.overflowX
=
'hidden';
showRightDiv(divId, divWidth
+
10
, scrollSpeed,
0
);
break
;
case
"
center
"
:
showCenterDiv(tagDiv, divWidth, divHeight, divLeft, divTop, bgOpacity);
break
;
}
}
//
從左邊彈出DIV
function
showLeftDiv(divId, divWidth, scrollSpeed, i)
{
//
獲得目標(biāo)DIV
var
tagDiv
=
document.getElementById(divId);
if
(tagDiv
==
null
)
{
return
;
}
if
(i
<=
20
)
{
tagDiv.style.left
=
divWidth
*
(
-
1
)
*
(
1
-
Math.sin((
3.14
/
2
)
*
(i
/
20
)));
i
++
;
window.setTimeout(
"
showLeftDiv('
"
+
divId
+
"
',
"
+
divWidth
+
"
,
"
+
scrollSpeed
+
"
,
"
+
i
+
"
)
"
,scrollSpeed
/
20
);
}
}
//
從右邊彈出DIV
function
showRightDiv(divId, divWidth, scrollSpeed, i)
{
//
獲得目標(biāo)DIV
var
tagDiv
=
document.getElementById(divId);
if
(tagDiv
==
null
)
{
return
;
}
if
(i
<=
20
)
{
tagDiv.style.right
=
divWidth
*
(
-
1
)
*
(
1
-
Math.sin((
3.14
/
2
)
*
(i
/
20
)));
i
++
;
window.setTimeout(
"
showRightDiv('
"
+
divId
+
"
',
"
+
divWidth
+
"
,
"
+
scrollSpeed
+
"
,
"
+
i
+
"
)
"
,scrollSpeed
/
20
);
}
else
{
document.body.style.overflowX
=
'';
}
}
//
從中間彈出DIV
function
showCenterDiv(tagDiv, divWidth, divHeight, divLeft, divTop, bgOpacity)
{
var
bgDiv
=
document.createElement(
"
div
"
);
//
最外層div
var
iframe
=
document.createElement(
"
iframe
"
);
//
協(xié)助wc.div蓋select的iframe
bgDiv.setAttribute(
"
id
"
,
"
bgDiv_S
"
);
iframe.setAttribute(
"
id
"
,
"
iframe_S
"
);
bgDiv.style.position
=
"
absolute
"
;
bgDiv.style.background
=
"
#000000
"
;
bgDiv.style.left
=
0
;
bgDiv.style.top
=
0
;
bgDiv.style.zIndex
=
"
99
"
;
bgDiv.style.filter
=
"
progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=
"
+
bgOpacity
+
"
,finishOpacity=75)
"
;
bgDiv.style.opacity
=
bgOpacity
/
100
;
iframe.style.position
=
"
absolute
"
;
iframe.style.background
=
"
#000000
"
;
iframe.style.left
=
0
;
iframe.style.top
=
0
;
iframe.style.zIndex
=
"
98
"
;
iframe.style.filter
=
"
progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0,finishOpacity=75)
"
;
iframe.style.opacity
=
0
;
tagDiv.style.position
=
"
absolute
"
;
if
(tagDiv.style.background
==
""
)
{
tagDiv.style.background
=
"
#FFF
"
;
}
tagDiv.style.zIndex
=
"
101
"
;
tagDiv.style.width
=
divWidth
+
"
px
"
;
tagDiv.style.height
=
divHeight
+
"
px
"
;
document.body.appendChild(iframe);
document.body.appendChild(bgDiv);
setPosition();
//
window.onscroll=setPosition;
//
window.onresize=setPosition;
function
setPosition()
{
bgDiv.style.height
=
iframe.style.height
=
Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body.scrollHeight)
+
"
px
"
;
bgDiv.style.width
=
iframe.style.width
=
Math.max(document.documentElement.scrollWidth, document.documentElement.offsetWidth)
+
"
px
"
;
tagDiv.style.left
=
divLeft
>
0
?
divLeft:
0
;
tagDiv.style.top
=
divTop
>
0
?
Math.max(document.documentElement.scrollTop,document.body.scrollTop)
+
divTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop);
}
}
//
********************************************頁面彈出DIV代碼_SHOW End***********************************************//
//
***************************************頁面彈出DIV代碼_HIDE Felix 2007-12-07***************************************//
//
跳出的DIV隱藏
function
divHide(divId, hideType, hideProperty)
{
//
獲得目標(biāo)DIV
var
tagDiv
=
document.getElementById(divId);
if
(tagDiv
==
null
)
{
return
;
}
tagDiv.style.display
=
""
;
//
設(shè)置默認(rèn)屬性
var
divWidth
=
tagDiv.offsetWidth;
//
目標(biāo)DIV的寬度
var
divHeight
=
tagDiv.offsetHeight;
//
目標(biāo)DIV的高度
var
divLeft
=
(Math.max(document.documentElement.offsetWidth, document.body.scrollWidth)
-
divWidth)
/
2
;
//
目標(biāo)DIV左邊定位
var
divTop
=
(Math.max(document.documentElement.offsetHeight, document.body.scrollHeight)
-
divHeight)
/
2
;
//
目標(biāo)DIV頂端定位
var
bgOpacity
=
30
;
//
背景的透明度 0為全透明 100為不透明
var
scrollSpeed
=
100
;
//
從邊框滾動出來的DIV的滾出速度 單位:毫秒
//
讀取設(shè)置屬性
var
propertys
=
hideProperty.split(';');
for
(
var
i
=
0
;i
<
propertys.length;i
++
)
{
var
property
=
propertys[i].trim().split(':');
if
(property.length
==
2
)
{
var
propertyValue
=
property[
1
].trim().replace(
"
px
"
,
""
);
if
(
!
isNumber(propertyValue))
{
return
;}
switch
(property[
0
].trim().toLowerCase())
{
case
"
width
"
:
divWidth
=
propertyValue;
break
;
case
"
height
"
:
divHeight
=
propertyValue;
break
;
case
"
left
"
:
divLeft
=
propertyValue;
break
;
case
"
top
"
:
divTop
=
propertyValue;
break
;
case
"
opacity
"
:
bgOpacity
=
propertyValue;
break
;
case
"
speed
"
:
scrollSpeed
=
propertyValue;
break
;
}
}
}
//
根據(jù)彈出類型,調(diào)用不同方法
switch
(hideType.toLowerCase())
{
case
"
left
"
:
hideLeftDiv(divId, divWidth
+
10
, scrollSpeed,
0
);
break
;
case
"
right
"
:
document.body.style.overflowX
=
'hidden';
hideRightDiv(divId, divWidth
+
10
, scrollSpeed,
0
);
break
;
case
"
center
"
:
hideCenterDiv(tagDiv);
break
;
}
}
//
隱藏左邊彈出的DIV
function
hideLeftDiv(divId, divWidth, scrollSpeed, i)
{
//
獲得目標(biāo)DIV
var
tagDiv
=
document.getElementById(divId);
if
(tagDiv
==
null
)
{
return
;
}
if
(i
<=
20
)
{
tagDiv.style.left
=
divWidth
*
(
-
1
)
*
(Math.sin((
3.14
/
2
)
*
(i
/
20
)));
i
++
;
window.setTimeout(
"
hideLeftDiv('
"
+
divId
+
"
',
"
+
divWidth
+
"
,
"
+
scrollSpeed
+
"
,
"
+
i
+
"
)
"
,scrollSpeed
/
20
);
}
}
//
隱藏右邊彈出的DIV
function
hideRightDiv(divId, divWidth, scrollSpeed, i)
{
//
獲得目標(biāo)DIV
var
tagDiv
=
document.getElementById(divId);
if
(tagDiv
==
null
)
{
return
;
}
if
(i
<=
20
)
{
tagDiv.style.right
=
divWidth
*
(
-
1
)
*
(Math.sin((
3.14
/
2
)
*
(i
/
20
)));
i
++
;
window.setTimeout(
"
hideRightDiv('
"
+
divId
+
"
',
"
+
divWidth
+
"
,
"
+
scrollSpeed
+
"
,
"
+
i
+
"
)
"
,scrollSpeed
/
20
);
}
else
{
tagDiv.style.display
=
"
none
"
;
document.body.style.overflowX
=
'';
}
}
//
隱藏中間彈出的DIV
function
hideCenterDiv(tagDiv)
{
var
bgDiv
=
document.getElementById(
"
bgDiv_S
"
);
//
最外層div
var
iframe
=
document.getElementById(
"
iframe_S
"
);
//
協(xié)助wc.div蓋select的iframe
tagDiv.style.display
=
"
none
"
;
document.body.removeChild(iframe);
document.body.removeChild(bgDiv);
//
window.onscroll=null;
//
window.onresize=null;
}
//
********************************************頁面彈出DIV代碼_HIDE End***********************************************//
posted on 2008-01-24 10:50
MingIsMe
閱讀(882)
評論(0)
編輯
收藏
所屬分類:
02 Script/CSS
Powered by:
BlogJava
Copyright © MingIsMe
主站蜘蛛池模板:
平塘县
|
左云县
|
宜兴市
|
丘北县
|
新丰县
|
苗栗县
|
炎陵县
|
柏乡县
|
胶州市
|
赤水市
|
岐山县
|
乌审旗
|
吴江市
|
会昌县
|
渭南市
|
永胜县
|
封开县
|
巫山县
|
泾阳县
|
老河口市
|
阿克陶县
|
遵化市
|
通化县
|
五寨县
|
屯门区
|
巴南区
|
怀远县
|
武城县
|
朝阳市
|
海晏县
|
菏泽市
|
湟源县
|
乌拉特前旗
|
永泰县
|
大荔县
|
新源县
|
武乡县
|
奉贤区
|
宜春市
|
湖口县
|
垦利县
|