66、弹出幻灯窗口
类别: JavaScript教程
弹出象幻灯片窗口[推荐][根据提示进行修改即可][共2步]
====1、将以下代码加入HTML的<HEAD></HEAD>之间
<script>
<!-- Beginning of JavaScript -
// The name of the pop-up-window. Do not change it.
var popwindow
// 弹出窗体的长度
var popwindowwidth=200
// 弹出窗体的宽度
var popwindowheight=150
// 窗体距离屏幕顶端的距离
var popwindowtop=20
// 弹出窗体的名称
var popwindowURL="窗体名称.htm"
// 窗体的停留时间
var waitingtime=4
// Configure ths speed of the pop-up-window
var pause=20
var step=40
// Do not change this variable
var popwindowleft=-popwindowwidth-50
// Do not change this variable
var marginright
// Do not change this variable
var pagecenter
// Do not change this variable
var timer
waitingtime= waitingtime*1000
function showWindow() {
popwindow = window.open(popwindowURL, "popwindow", "toolbar=no,width="+popwindowwidth+",height="+popwindowheight+",top="+popwindowtop+",left="+(-popwindowwidth)+"");
if (document.all) {
marginright = screen.width+50
}
if (document.layers) {
marginright = screen.width+50
}
pagecenter=Math.floor(marginright/2)-Math.floor(popwindowwidth/2)
movewindow()
}
function movewindow() {
if (popwindowleft<=pagecenter) {
popwindow.moveTo(popwindowleft,popwindowtop)
popwindowleft+=step
timer= setTimeout("movewindow()",pause)
}
else {
clearTimeout(timer)
timer= setTimeout("movewindow2()",waitingtime)
}
}
function movewindow2() {
if (popwindowleft<=marginright) {
popwindow.moveTo(popwindowleft,popwindowtop)
popwindowleft+=step
timer= setTimeout("movewindow2()",pause)
}
else {
clearTimeout(timer)
popwindow.close()
}
}
// -->
</script>
====2、将以下代码加入HEML的<BODY></BODY>之间
<body bgcolor="#FFFFFF" onLoad="showWindow()">
====1、将以下代码加入HTML的<HEAD></HEAD>之间
<script>
<!-- Beginning of JavaScript -
// The name of the pop-up-window. Do not change it.
var popwindow
// 弹出窗体的长度
var popwindowwidth=200
// 弹出窗体的宽度
var popwindowheight=150
// 窗体距离屏幕顶端的距离
var popwindowtop=20
// 弹出窗体的名称
var popwindowURL="窗体名称.htm"
// 窗体的停留时间
var waitingtime=4
// Configure ths speed of the pop-up-window
var pause=20
var step=40
// Do not change this variable
var popwindowleft=-popwindowwidth-50
// Do not change this variable
var marginright
// Do not change this variable
var pagecenter
// Do not change this variable
var timer
waitingtime= waitingtime*1000
function showWindow() {
popwindow = window.open(popwindowURL, "popwindow", "toolbar=no,width="+popwindowwidth+",height="+popwindowheight+",top="+popwindowtop+",left="+(-popwindowwidth)+"");
if (document.all) {
marginright = screen.width+50
}
if (document.layers) {
marginright = screen.width+50
}
pagecenter=Math.floor(marginright/2)-Math.floor(popwindowwidth/2)
movewindow()
}
function movewindow() {
if (popwindowleft<=pagecenter) {
popwindow.moveTo(popwindowleft,popwindowtop)
popwindowleft+=step
timer= setTimeout("movewindow()",pause)
}
else {
clearTimeout(timer)
timer= setTimeout("movewindow2()",waitingtime)
}
}
function movewindow2() {
if (popwindowleft<=marginright) {
popwindow.moveTo(popwindowleft,popwindowtop)
popwindowleft+=step
timer= setTimeout("movewindow2()",pause)
}
else {
clearTimeout(timer)
popwindow.close()
}
}
// -->
</script>
====2、将以下代码加入HEML的<BODY></BODY>之间
<body bgcolor="#FFFFFF" onLoad="showWindow()">
- 上一篇: 65、滚动逐显的文字
- 下一篇: 67、随意飘动的图象
-= 资 源 教 程 =-
文 章 搜 索