<script language=JavaScript> float_init = 1;
function DHTML_Init(Object) {
if (navigator.userAgent.match(/Mozilla\/5\../) && float_init) {
SetObjectOffsetTop(Object, undefined);
} }
function All (ID) {
if (document.all) { return document.all[ID]; }
else if (document.documentElement){
return document.getElementById (ID); }
else if (document.layers) { return document.layers[ID]; }}
function GetWindowOffsetTop() {
if (window.innerHeight) { return window.pageYOffset; }
else if (document.body) { return document.body.scrollTop; }}
function GetWindowHeight() {
if (window.innerHeight) { return window.innerHeight; }
else if (document.body) { return document.body.clientHeight; }}
function GetObjectHeight(Object) {
DHTML_Init(Object);
if (document.all || document.documentElement) {
Clip = Object.style.clip;
if (! Clip) { return Object.offsetHeight; }
else { return GetClipElement (Clip, 'Bottom'); }}
else if (document.layers) { return Object.clip.height; }}
function GetClipElement (Clip, Element) {
Clip = Clip.substr(Clip.indexOf('(') + 1);
Clip = Clip.substr(0, Clip.length - 1);
Clippers = Clip.split (" ");
for (i = 0; i < Clippers.length; i++) {
if (Clippers[i] != 'auto')
{ Clippers[i] = Clippers[i].replace (/D/g, ""); }}
ClipTop = Number(Clippers[0]);
ClipRight = Number(Clippers[1]);
ClipBottom = Number(Clippers[2]);
ClipLeft = Number(Clippers[3]);
if (Element == 'Top') { return ClipTop; }
else if (Element == 'Right') { return ClipRight; }
else if (Element == 'Bottom') { return ClipBottom; }
else if (Element == 'Left') { return ClipLeft; }
else { return undefined; }}
function GetObjectOffsetTop(Object) {
DHTML_Init(Object);
if (Object.offsetTop) { return Object.offsetTop; }
else if (document.layers) { return Object.top; }}
function SetObjectOffsetTop(Object, Offset) {
if (Object.style) { Object.style.top = Offset; }
else if (Object.top) { Object.top = Offset; }}
CenterMenu = 1;
MenuBorder = 100;
TimeCheck = 250;
TimeUpdate = 15;
DivUpdate = 15;
Minimum = 50;
AddHeight = -4;
function ScrollMenu() {
Menu = All('persistMenu');
WinTop = GetWindowOffsetTop();
WinHeight = GetWindowHeight() + AddHeight;
MenuTop = GetObjectOffsetTop(Menu);
MenuHeight = GetObjectHeight (Menu);
MenuNew = (CenterMenu) ? Math.round (WinTop + (WinHeight - MenuHeight) / 1) : WinTop + MenuBorder;
if (MenuNew < Minimum)
{ MenuNew = Minimum; }
if (MenuTop != MenuNew) {
if ( (MenuTop + MenuHeight) < WinTop || MenuTop > (WinTop + WinHeight) ) {
SetObjectOffsetTop (Menu, (MenuTop < MenuNew) ? (WinTop - MenuHeight) : (WinTop + WinHeight));
} else {
Add = (MenuTop < MenuNew) ? 1 : -1;
SetObjectOffsetTop (Menu, MenuTop + Math.round((MenuNew - MenuTop) / DivUpdate) + Add);
}
}
window.setTimeout('ScrollMenu()', (GetObjectOffsetTop(Menu) == MenuNew) ? TimeCheck : TimeUpdate);
} </script>
function DHTML_Init(Object) {
if (navigator.userAgent.match(/Mozilla\/5\../) && float_init) {
SetObjectOffsetTop(Object, undefined);
} }
function All (ID) {
if (document.all) { return document.all[ID]; }
else if (document.documentElement){
return document.getElementById (ID); }
else if (document.layers) { return document.layers[ID]; }}
function GetWindowOffsetTop() {
if (window.innerHeight) { return window.pageYOffset; }
else if (document.body) { return document.body.scrollTop; }}
function GetWindowHeight() {
if (window.innerHeight) { return window.innerHeight; }
else if (document.body) { return document.body.clientHeight; }}
function GetObjectHeight(Object) {
DHTML_Init(Object);
if (document.all || document.documentElement) {
Clip = Object.style.clip;
if (! Clip) { return Object.offsetHeight; }
else { return GetClipElement (Clip, 'Bottom'); }}
else if (document.layers) { return Object.clip.height; }}
function GetClipElement (Clip, Element) {
Clip = Clip.substr(Clip.indexOf('(') + 1);
Clip = Clip.substr(0, Clip.length - 1);
Clippers = Clip.split (" ");
for (i = 0; i < Clippers.length; i++) {
if (Clippers[i] != 'auto')
{ Clippers[i] = Clippers[i].replace (/D/g, ""); }}
ClipTop = Number(Clippers[0]);
ClipRight = Number(Clippers[1]);
ClipBottom = Number(Clippers[2]);
ClipLeft = Number(Clippers[3]);
if (Element == 'Top') { return ClipTop; }
else if (Element == 'Right') { return ClipRight; }
else if (Element == 'Bottom') { return ClipBottom; }
else if (Element == 'Left') { return ClipLeft; }
else { return undefined; }}
function GetObjectOffsetTop(Object) {
DHTML_Init(Object);
if (Object.offsetTop) { return Object.offsetTop; }
else if (document.layers) { return Object.top; }}
function SetObjectOffsetTop(Object, Offset) {
if (Object.style) { Object.style.top = Offset; }
else if (Object.top) { Object.top = Offset; }}
CenterMenu = 1;
MenuBorder = 100;
TimeCheck = 250;
TimeUpdate = 15;
DivUpdate = 15;
Minimum = 50;
AddHeight = -4;
function ScrollMenu() {
Menu = All('persistMenu');
WinTop = GetWindowOffsetTop();
WinHeight = GetWindowHeight() + AddHeight;
MenuTop = GetObjectOffsetTop(Menu);
MenuHeight = GetObjectHeight (Menu);
MenuNew = (CenterMenu) ? Math.round (WinTop + (WinHeight - MenuHeight) / 1) : WinTop + MenuBorder;
if (MenuNew < Minimum)
{ MenuNew = Minimum; }
if (MenuTop != MenuNew) {
if ( (MenuTop + MenuHeight) < WinTop || MenuTop > (WinTop + WinHeight) ) {
SetObjectOffsetTop (Menu, (MenuTop < MenuNew) ? (WinTop - MenuHeight) : (WinTop + WinHeight));
} else {
Add = (MenuTop < MenuNew) ? 1 : -1;
SetObjectOffsetTop (Menu, MenuTop + Math.round((MenuNew - MenuTop) / DivUpdate) + Add);
}
}
window.setTimeout('ScrollMenu()', (GetObjectOffsetTop(Menu) == MenuNew) ? TimeCheck : TimeUpdate);
} </script>
style="HEIGHT: 60px; LEFT: 130px; POSITION: absolute; TOP: 87px; WIDTH: 64px; Z-INDEX: 100">
<table border=0 cellpadding=0 cellspacing=0 width="100%">
<tbody>
<tr>
<td><a href="/dreamweaver/index.asp"><img src="../../../image/index_dreamweaver.gif" width="60" height="60" border="0" alt="Dreamweaver 资源"></a></td>
</tr>
</tbody>
</table>
</div>
第一步:把如下代码加入<body>区域中
<style type="text/css">
#plane1 {position:absolute; left:290; top:170; width:121; z-index:0}
#plane2 {position:absolute; left:400; top:250; width:118; z-index:0}
</style>
<SCRIPT LANGUAGE="JavaScript">
//Modified by the CoffeeCup HTML Editor++
//http://www.coffeecup.com
// Global variables for platform branching
var isNav, isIE
if (parseInt(navigator.appVersion) >= 4) {
if (navigator.appName == "Netscape") {
isNav = true
} else {
isIE = true
}
}// ***Begin CSS custom API Functions***
// Set zIndex property
function setZIndex(obj, zOrder) {
obj.zIndex = zOrder
}
// Position an object at a specific pixel coordinate
function shiftTo(obj, x, y) {
if (isNav) {
obj.moveTo(x,y)
} else {
obj.pixelLeft = x
obj.pixelTop = y
}
}
// ***End API Functions***// Global holds reference to selected element
var selectedObj
// Globals hold location of click relative to element
var offsetX, offsetY// Find out which element has been clicked on
function setSelectedElem(evt) {
if (isNav) {
// declare local var for use in upcoming loop
var testObj
// make copies of event coords for use in upcoming loop
var clickX = evt.pageX
var clickY = evt.pageY
// loop through all layers (starting with frontmost layer)
// to find if the event coordinates are in the layer
for (var i = document.layers.length - 1; i >= 0; i--) {
testObj = document.layers[i]
if ((clickX > testObj.left) &&
(clickX < testObj.left + testObj.clip.width) &&
(clickY > testObj.top) &&
(clickY < testObj.top + testObj.clip.height)) {
// if so, then set the global to the layer, bring it
// forward, and get outa here
selectedObj = testObj
setZIndex(selectedObj, 100)
return
}
}
} else {
// use IE event model to get the targeted element
var imgObj = window.event.srcElement
// make sure it's one of our planes
if (imgObj.parentElement.id.indexOf("plane") != -1) {
// then set the global to the style property of the element,
// bring it forward, and say adios
selectedObj = imgObj.parentElement.style
setZIndex(selectedObj,100)
return
}
}
// the user probably clicked on the background
selectedObj = null
return
}
// Drag an element
function dragIt(evt) {
// operate only if a plane is selected
if (selectedObj) {
if (isNav) {
shiftTo(selectedObj, (evt.pageX - offsetX), (evt.pageY - offsetY))
} else {
shiftTo(selectedObj, (window.event.clientX - offsetX), (window.event.clientY - offsetY))
// prevent further system response to dragging in IE
return false
}
}
}
// Set globals to connect with selected element
function engage(evt) {
setSelectedElem(evt)
if (selectedObj) {
// set globals that remember where the click is in relation to the
// top left corner of the element so we can keep the element-to-cursor
// relationship constant throughout the drag
if (isNav) {
offsetX = evt.pageX - selectedObj.left
offsetY = evt.pageY - selectedObj.top
} else {
offsetX = window.event.offsetX
offsetY = window.event.offsetY
}
}
// block mouseDown event from forcing Mac to display
// contextual menu.
return false
}
// Restore elements and globals to initial values
function release(evt) {
if (selectedObj) {
setZIndex(selectedObj, 0)
selectedObj = null
}
}
// Turn on event capture for Navigator
function setNavEventCapture() {
if (isNav) {
document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP)
}
}
// Assign event handlers used by both Navigator and IE (called by onLoad)
function init() {
if (isNav) {
setNavEventCapture()
}
// assign functions to each of the events (works for both Navigator and IE)
document.onmousedown = engage
document.onmousemove = dragIt
document.onmouseup = release
}
</SCRIPT>
<DIV ID=plane1><IMG NAME="planePic1" SRC="clock1.jpg" BORDER=0></DIV>
<DIV ID=plane2><IMG NAME="planePic1" SRC="clock2.jpg" BORDER=0></DIV>第二步:把<body>区域中内容改为:
<body bgcolor="#fef4d9" onLoad="init()">