飄浮的連結2

檔案下載 : 1

將下列程式碼複製至<head>程式碼</head>區內

<script language="JavaScript1.2">
<!--
var IE4 = (document.all) ? true : false;
var NS4 = (document.layers) ? true : false;
function docjslib_doThisCommandEveryIntervalMS(command, interval) {
setInterval(eval('"' + command + '"'), interval);
}
function docjslib_getWindowWidth() {
if (NS4) {return window.innerWidth}
else {return document.body.clientWidth}
}
function docjslib_getWindowHeight() {
if (NS4) {return window.innerHeight}
else {return document.body.clientHeight}
}
function docjslib_getPageScrollLeft() {
if (NS4) {return window.pageXOffset}
else {return document.body.scrollLeft}
}
function docjslib_getPageScrollTop() {
if (NS4) {return window.pageYOffset}
else {return document.body.scrollTop}
}
function docjslib_getSrc(id) {
if (NS4) {return eval("document." + id + ".document." + id + "img.src")}
else {return eval("document.all." + id + "img.src")}
}
function docjslib_setSrc(id, url) {
if (NS4) {eval("document." + id + ".document." + id + "img").src = url}
else {eval("document.all." + id + "img").src = url}
}
function docjslib_getWidth(id) {
if (NS4) {return eval("document." + id + ".clip.width")}
else {return eval("document.all." + id + ".style.pixelWidth")}
}
function docjslib_getVisibility(id) {
if (NS4) {
if (eval("document." + id).visibility == "show") return true
else return false;
}
else {
if (eval("document.all." + id).style.visibility == "visible") return true
else return false;
}
}
function docjslib_setVisibility(id, flag) {
if (NS4) {
var str = (flag) ? 'show' : 'hide';
eval("document." + id).visibility = str;
}
else {
var str = (flag) ? 'visible' : 'hidden';
eval("document.all." + id).style.visibility = str;
}
}
function docjslib_setPosFromLeft(id, xCoord) {
if (NS4) {eval("document." + id).left = xCoord}
else {eval("document.all." + id).style.left = xCoord}
}
function docjslib_setPosFromTop(id, yCoord) {
if (NS4) {eval("document." + id).top = yCoord}
else {eval("document.all." + id).style.top = yCoord}
}
function docjslib_setZposition(id, z) {
if (NS4) {eval("document." + id).zIndex = z}
else {eval("document.all." + id).style.zIndex = z}
}
function docjslib_findHighestZ() {
var documentDivs = new Array();
if (NS4) {documentDivs = document.layers}
else {documentDivs = document.all.tags("DIV")};
var highestZ = 0;
for (var i = 0; i < documentDivs.length; i++) {
var zIndex = (NS4) ? documentDivs[i].zIndex : documentDivs[i].style.zIndex;
highestZ = (zIndex > highestZ) ? zIndex : highestZ;
}
return highestZ;
}
function docjslib_makeClickedImage(imgID, // given id
imgURL, // image URL
imgHeight, // image height
imgWidth, // image width
imgAlt, // alternative image
posFromLeft, // absolute position from left of window
posFromTop, // absolute position from top of window
clickParam1, // parameter passed to "onclick" handler
clickParam2) // parameter passed to "onclick" handler
{
document.write(
'<STYLE TYPE="text/css">',
'#', imgID, ' {',
'position: absolute;',
'left: ', posFromLeft, ';',
'top: ', posFromTop, ';',
'width: ', imgWidth, ';',
'z-index: 1',
'}',
'</STYLE>',
'<DIV ID="', imgID, '">',
'<A HREF="javascript:', "handleImageClick('", imgID, "'", ',', clickParam1, ',',
clickParam2, ')" target="_top">',
'<IMG NAME="', imgID, 'img" ID="', imgID, 'img" SRC="', imgURL, '" ALT="', imgAlt,
'" BORDER="0" ', 'HEIGHT="', imgHeight, '" WIDTH="', imgWidth, '">',
'</A></DIV>'
);
}
function docjslib_makeLinkedImage(imgID, // given id
imgURL, // image URL
linkURL, // link URL
imgHeight, // image height
imgWidth, // image width
imgAlt, // alternative image
posFromLeft, // absolute position from left of window
posFromTop, // absolute position from top of window
imgVisibility, // image visibility (true of false)
imgZindex) // image Z index
{
var visibility = (imgVisibility) ? 'visible' : 'hidden';
document.write(
'<STYLE TYPE="text/css">',
'#', imgID, ' {',
'position: absolute;',
'visibility: ', visibility, ';',
'left: ', posFromLeft, ';',
'top: ', posFromTop, ';',
'width: ', imgWidth, ';',
'z-index:', imgZindex,
'}',
'</STYLE>',
'<DIV ID="', imgID, '">',
'<A HREF="', linkURL, '" target="_top">',
'<IMG NAME="', imgID, 'img" ID="', imgID, 'img" SRC="', imgURL, '" ALT="', imgAlt,
'" BORDER="0" ', 'HEIGHT="', imgHeight, '" WIDTH="', imgWidth, '">',
'</A></DIV>'
);
}
function docjslib_makeBox(boxID, // given id
htmlFiller, // HTML filler
boxWidth, // box width
posFromLeft, // absolute position from left of window
posFromTop, // absolute position from top of window
boxBg, // box background color
boxColor, // html filler text color
boxVisibility) // visibility

{
var padding = (NS4) ? '' : 'padding: 3 0 3 3;';
var visibility = (boxVisibility) ? 'visible' : 'hidden';
document.write(
'<STYLE TYPE="text/css">',
'#', boxID, ' {',
'position: absolute;',
'left: ', posFromLeft, '; top: ', posFromTop, ';',
'width: ', boxWidth, ';',
'layer-background-color: ', boxBg, ';',
'background-color: ', boxBg, ';',
'visibility: ', visibility, ';',
'border-width: 2;',
'border-style: solid;',
'border-color: ', boxColor, ';',
padding,
'z-index: 1',
'}',
'</STYLE>',
'<DIV ID="', boxID, '">',
htmlFiller,
'</DIV>'
);
}

var windowWidth= 0;
var windowHeight= 0;
var pageScrollLeft= 0;
var pageScrollTop= 0;
var imageWidth= 100;
var imageHeight= 50;
var rightSpacer= 5;
var bottomSpacer= 5;
function waterMark(){
if (navigator.appVersion.indexOf("Mac") == -1){
oldWindowWidth= windowWidth;
oldWindowHeight= windowHeight;
oldPageScrollLeft= pageScrollLeft;
oldPageScrollTop= pageScrollTop;
windowWidth = docjslib_getWindowWidth();
windowHeight = docjslib_getWindowHeight();
pageScrollLeft = docjslib_getPageScrollLeft();
pageScrollTop = docjslib_getPageScrollTop();
if ((windowHeight != oldWindowHeight)||(windowWidth !=
oldWindowWidth)||(pageScrollLeft != oldPageScrollLeft)||
(pageScrollTop != oldPageScrollTop)){
docjslib_setPosFromTop("docjslib", windowHeight + pageScrollTop -
(imageHeight + bottomSpacer));
docjslib_setPosFromLeft("docjslib", windowWidth + pageScrollLeft -
(imageWidth + rightSpacer));
var topZ = docjslib_findHighestZ();
docjslib_setZposition("docjslib", topZ);
}
}

}
docjslib_makeLinkedImage("docjslib", // id
"nslogo.jpg", // image URL
"../index.htm", // link URL
50, // height
100, // width
"鄉城風情", // alternative
0, // position from left
0, // position from top
true, // visibility
0); // z index

docjslib_doThisCommandEveryIntervalMS("waterMark()", 100);
// -->
</script>