Tue

17

Mar

2009

128、用鼠标拖动图片

128用鼠标拖动图片

脚本说明:

第一步:把如下代码加入<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="sto/051.gif" BORDER=0></DIV>

<DIV ID=plane2><IMG NAME="planePic1" SRC="sto/0003.gif" BORDER=0></DIV>

 

第二步:<body>区域中内容改为:

<body bgcolor="#fef4d9" onLoad="init()">

 

0 Comments

Tue

17

Mar

2009

127、鼠标移上去显示半透明并带边框的链接

127、鼠标移上去显示半透明并带边框的链接

要完成此效果把如下代码加入到<body>区域中

 

<script language="JavaScript">

if ( had_tips != 1 ) {

var    _ua = document.all ? ((navigator.userAgent.indexOf('MSIE 5') > 5) ? "ie5" : "ie4") : "foo";

if (_ua != "foo" ) {

    if (typeof(_doc) == "undefined" || _doc == null) _doc = document;

    var    _tipx = 0;

    var    _tipy = 0;

    var    _tipOX = 10;

    var    _tipOY = 1;

    var    _tipWidth;

   

    // Opacity=70 提示框背景透明度

    _doc.write('<DIV ID="TIP__" STYLE="filter:Alpha(Opacity=70,style=1,Finishopacity=80);position:absolute;display:none;z-index:100"></DIV>');

   

    _doc.onmousemove = tsai;

    var    _tip = _doc.all['TIP__'];

    }

}

var    had_tips = 1;

function tsaiannie (sMsg, sTitle, iWidth, iHeight, iBorder, sTFC, sTBC, sMFC, sMBC) {

 

    _tipWidth = 180;         // 提示框的寬度

    var    _tipBorder = 2,      // 提示框边框的寬度

    _tipTFC = "#FFF8F0", 

    _tipTBC = "#ff8c00",      // 提示框边框的顏色

    _tipMFC = "#3F3F38",

    _tipMBC = "ffffff";      // 提示框背景的顏色

   

    if (_ua == "foo") return;

    _tip.innerHTML    = '<TABLE CELLPADDING="'+_tipBorder+'" CELLSPACING="0" WIDTH="'+_tipWidth+'" BORDER="0" BGCOLOR="'+_tipTBC+'"><TR><TD>'

            + ((sTitle != null) ? '<TABLE CELLPADDING="0" CELLSPACING="0" WIDTH="100%" BORDER="0"><TR><TD STYLE="padding-top:2px;padding-bottom:2px;font:8pt Arial,Verdana,Tahoma;color:'+_tipTFC+'">'+sTitle+'</TD></TR></TABLE>' : '')

            + '<TABLE CELLPADDING="2" CELLSPACING="0" WIDTH="100%" BORDER="0" BGCOLOR="'+_tipMBC+'"><TR><TD STYLE="color:'+_tipMFC+';font:normal 8pt Arial,Verdana,Tahoma">'+sMsg+'</TD></TR></TABLE></TD></TR></TABLE>';

    annie();

    _tip.style.display = "";

}

 

function tsai() {

    if (_ua == "ie4") {

        _tipx = event.x;

        _tipy = event.y;

    } else if (_ua == "ie5") {

        _tipx = (event.clientX + _tipOX + _tipWidth <= _doc.body.clientWidth) ?

            (event.clientX + _doc.body.scrollLeft + _tipOX) :

            (event.clientX + _doc.body.scrollLeft - _tipWidth - 5);

        _tipy = event.clientY + _doc.body.scrollTop + _tipOY;

    } else {

        return;

    }

    if (_tip.style.display != "none") annie();

}

 

function annie() {

    _tip.style.pixelTop = _tipy;

    _tip.style.pixelLeft = _tipx;

}

 

function tsai900403 () {

    _tip.style.display = "none";

}

 

document.write('<A HREF="http://free.2259.com/" ONMOUSEOVER="tsaiannie(\'看到了<font color=#ff1493>效果</font>了吗?\' )" ONMOUSEOUT="tsai900403()" target="_blank">鼠标移过来看效果</A><DIV></DIV>');

</script>

 

 

0 Comments

Tue

17

Mar

2009

126、禁止鼠标右键的几种方法

126、禁止鼠标右键的几种方法

方法一:最简单的方法

 

<SCRIPT language="JavaScript"> 

  function click()

  { 

   if(event.button==2)

     {

        alert('右键不能用了!') 

     } 

  } 

  document.onmousedown=click 

</SCRIPT> 

 

    这是最简单,也是最常用的方法

 

 

 

方法二:添加到收藏夹

 

<SCRIPT language="JavaScript"> 

  function click()

  { 

     if(event.button==2)

     {

        window.external.addFavorite('http://free.2259.com','网站建设帮助中心');

     }

  } 

  document.onmousedown=click 

</SCRIPT>

 

 

 

方法三:使右键失效

 

<body>改成<body oncontextmenu=self.event.returnValue=false>

 

    该方法须IE5以上

 

 

 

方法四:

 

<body>改成<body ondragstart="window.event.returnValue=false" oncontextmenu="window.event.returnValue=false" onselectstart="event.returnValue=false">

 

    该方法使鼠标失效,效果和方法三差不多,但此时不能用鼠标选取页面上的内容,同时“编辑->全选”也没有作用。

 

 

0 Comments

Tue

17

Mar

2009

125、禁止鼠标左健右键点击

125、禁止鼠标左健右键点击

<SCRIPT LANGUAGE=javascript>

function click() {

alert('禁止你的左键复制!') }

function click1() {

if (event.button==2) {alert('禁止右键点击~') }}

function CtrlKeyDown(){

if (event.ctrlKey) {alert('不当的拷贝将损害您的系统!') }}

document.onkeydown=CtrlKeyDown;

document.onselectstart=click;

document.onmousedown=click1;

</SCRIPT>

 

 

0 Comments

Tue

17

Mar

2009

124、鼠标上的蜘蛛网

124、鼠标上的蜘蛛网

<html>

<head>

<title>鼠标上的蜘蛛网</title>

<style type="text/css">

<!--

body {  font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 0px; margin-right: 0px}

A { COLOR: black; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none }

 A:hover { COLOR: red; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: underline }

a:active     { font: 9pt "宋体"; cursor: hand; color: #FF0033 }

 

-->

</style>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

</head>

 

<body bgcolor="#ffccff">

<CENTER><script language="JavaScript" src="../news2.js"></script></CENTER>

<center><font color=red face="隶书" size=6>鼠标上的蜘蛛网</font></center>

<br>

<center>

<table border=5 bordercolor=blue borderlight=green>

<tr><td align=center><font size=4 color=red face="Arial, Helvetica, sans-serif"><strong>下面为效果显示</strong></font></td></tr>

<tr><td align=left>

<STYLE>

.disableHscroll{

width:100%;overflow-x:hidden;overflow-y:scroll;

}

 

v\:* {

 BEHAVIOR: url(#default#VML)

}

</STYLE>

<SCRIPT>

// the default color of the 8 spiderlines

var defaultcolor="#F5F5F5"

 

// the width of the 8 spiderlines while highlighting textlinks (pixels)

var lineweighthighlight=14

 

// the width of the 8 spiderlines while NOT highlighting textlinks (pixels)

var lineweightnormal=2

 

///////////////////////////////////////////////////////////////////////////

// CONFIGURATION ENDS HERE

///////////////////////////////////////////////////////////////////////////

 

var distancetomouse=0

 

var mousepos_x=0

var mousepos_x=0

 

var marginleft=0

var margintop=0

var marginbottom=0

var marginright=0

 

var margincenterx

var margincentery

 

var mousepos_x=0

var mousepos_x=0

 

if (document.all&&window.print){

    document.write('<div id="bodycontent" style="position:relative">')

}

 

function initiateanimation(){

 

    marginbottom=document.body.clientHeight

    marginright=document.body.clientWidth

    margincenterx=Math.floor(marginright/2)

    margincentery=Math.floor(marginbottom/2)

   

    rectangulartopleft.to=marginleft+","+margintop

    rectangulartopright.to=marginright+","+margintop

    rectangularbottomleft.to=marginleft+","+marginbottom

    rectangularbottomright.to=marginright+","+marginbottom

   

    rectangulartop.to=margincenterx+","+margintop

    rectangularright.to=marginright+","+margincentery

    rectangularbottom.to=margincenterx+","+marginbottom

    rectangularleft.to=marginleft+","+margincentery

   

    rectangulartopleft.strokecolor=defaultcolor

    rectangulartopright.strokecolor=defaultcolor

    rectangularbottomleft.strokecolor=defaultcolor

    rectangularbottomright.strokecolor=defaultcolor

   

    rectangulartop.strokecolor=defaultcolor

    rectangularright.strokecolor=defaultcolor

    rectangularbottom.strokecolor=defaultcolor

    rectangularleft.strokecolor=defaultcolor

}

 

function msover(thiscolorhighlight){

    if(document.all&&window.print){

        rectangulartopleft.strokecolor=thiscolorhighlight

        rectangulartopright.strokecolor=thiscolorhighlight

        rectangularbottomleft.strokecolor=thiscolorhighlight

        rectangularbottomright.strokecolor=thiscolorhighlight

   

        rectangulartop.strokecolor=thiscolorhighlight

        rectangularright.strokecolor=thiscolorhighlight

        rectangularbottom.strokecolor=thiscolorhighlight

        rectangularleft.strokecolor=thiscolorhighlight

       

        rectangulartopleft.strokeweight=lineweighthighlight

        rectangulartopright.strokeweight=lineweighthighlight

        rectangularbottomleft.strokeweight=lineweighthighlight

        rectangularbottomright.strokeweight=lineweighthighlight

   

        rectangulartop.strokeweight=lineweighthighlight

        rectangularright.strokeweight=lineweighthighlight

        rectangularbottom.strokeweight=lineweighthighlight

        rectangularleft.strokeweight=lineweighthighlight

    }

}

 

function msout(){

    if(document.all&&window.print){

        rectangulartopleft.strokecolor=defaultcolor

        rectangulartopright.strokecolor=defaultcolor

        rectangularbottomleft.strokecolor=defaultcolor

        rectangularbottomright.strokecolor=defaultcolor

   

        rectangulartop.strokecolor=defaultcolor

        rectangularright.strokecolor=defaultcolor

        rectangularbottom.strokecolor=defaultcolor

        rectangularleft.strokecolor=defaultcolor

       

        rectangulartopleft.strokeweight=lineweightnormal

        rectangulartopright.strokeweight=lineweightnormal

        rectangularbottomleft.strokeweight=lineweightnormal

        rectangularbottomright.strokeweight=lineweightnormal

   

        rectangulartop.strokeweight=lineweightnormal

        rectangularright.strokeweight=lineweightnormal

        rectangularbottom.strokeweight=lineweightnormal

        rectangularleft.strokeweight=lineweightnormal     

    }

}

 

 

function momouse(){

    if(document.all&&window.print){

        mousepos_x=document.body.scrollLeft+event.clientX

        mousepos_y=document.body.scrollTop+event.clientY

   

        rectangulartopleft.from=mousepos_x+","+mousepos_y

        rectangulartopright.from=mousepos_x+","+mousepos_y

        rectangularbottomleft.from=mousepos_x+","+mousepos_y

        rectangularbottomright.from=mousepos_x+","+mousepos_y

   

        rectangulartop.from=mousepos_x+","+mousepos_y

        rectangularright.from=mousepos_x+","+mousepos_y

        rectangularbottom.from=mousepos_x+","+mousepos_y

        rectangularleft.from=mousepos_x+","+mousepos_y

     }

}

 

if(document.all&&window.print){

    document.body.className="disableHscroll"

    code="<v:line id=rectangulartopleft style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangulartopright style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularbottomleft style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularbottomright style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

 

    code+="<v:line id=rectangulartop style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularright style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularbottom style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularleft style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

 

    document.body.insertAdjacentHTML("afterBegin",code)

    document.onmousemove=momouse

    window.onload=initiateanimation

}

</SCRIPT>

<a href="http://www.7stk.com" onMouseOver="msover('#FFEEEE')" onMouseOut="msout()">网络时空</a>

</td></tr>

</table></center>

<br>

<br><br>

<br>

<center>

<textarea name=source rows=12 cols=45 class=yk9>

脚本说明:

把如下代码加入<body>区域中

<STYLE>

.disableHscroll{

width:100%;overflow-x:hidden;overflow-y:scroll;

}

 

v\:* {

 BEHAVIOR: url(#default#VML)

}

</STYLE>

<SCRIPT>

// the default color of the 8 spiderlines

var defaultcolor="#F5F5F5"

 

// the width of the 8 spiderlines while highlighting textlinks (pixels)

var lineweighthighlight=14

 

// the width of the 8 spiderlines while NOT highlighting textlinks (pixels)

var lineweightnormal=2

 

///////////////////////////////////////////////////////////////////////////

// CONFIGURATION ENDS HERE

///////////////////////////////////////////////////////////////////////////

 

var distancetomouse=0

 

var mousepos_x=0

var mousepos_x=0

 

var marginleft=0

var margintop=0

var marginbottom=0

var marginright=0

 

var margincenterx

var margincentery

 

var mousepos_x=0

var mousepos_x=0

 

if (document.all&&window.print){

    document.write('<div id="bodycontent" style="position:relative">')

}

 

function initiateanimation(){

 

    marginbottom=document.body.clientHeight

    marginright=document.body.clientWidth

    margincenterx=Math.floor(marginright/2)

    margincentery=Math.floor(marginbottom/2)

   

    rectangulartopleft.to=marginleft+","+margintop

    rectangulartopright.to=marginright+","+margintop

    rectangularbottomleft.to=marginleft+","+marginbottom

    rectangularbottomright.to=marginright+","+marginbottom

   

    rectangulartop.to=margincenterx+","+margintop

    rectangularright.to=marginright+","+margincentery

    rectangularbottom.to=margincenterx+","+marginbottom

    rectangularleft.to=marginleft+","+margincentery

   

    rectangulartopleft.strokecolor=defaultcolor

    rectangulartopright.strokecolor=defaultcolor

    rectangularbottomleft.strokecolor=defaultcolor

    rectangularbottomright.strokecolor=defaultcolor

   

    rectangulartop.strokecolor=defaultcolor

    rectangularright.strokecolor=defaultcolor

    rectangularbottom.strokecolor=defaultcolor

    rectangularleft.strokecolor=defaultcolor

}

 

function msover(thiscolorhighlight){

    if(document.all&&window.print){

        rectangulartopleft.strokecolor=thiscolorhighlight

        rectangulartopright.strokecolor=thiscolorhighlight

        rectangularbottomleft.strokecolor=thiscolorhighlight

        rectangularbottomright.strokecolor=thiscolorhighlight

   

        rectangulartop.strokecolor=thiscolorhighlight

        rectangularright.strokecolor=thiscolorhighlight

        rectangularbottom.strokecolor=thiscolorhighlight

        rectangularleft.strokecolor=thiscolorhighlight

       

        rectangulartopleft.strokeweight=lineweighthighlight

        rectangulartopright.strokeweight=lineweighthighlight

        rectangularbottomleft.strokeweight=lineweighthighlight

        rectangularbottomright.strokeweight=lineweighthighlight

   

        rectangulartop.strokeweight=lineweighthighlight

        rectangularright.strokeweight=lineweighthighlight

        rectangularbottom.strokeweight=lineweighthighlight

        rectangularleft.strokeweight=lineweighthighlight

    }

}

 

function msout(){

    if(document.all&&window.print){

        rectangulartopleft.strokecolor=defaultcolor

        rectangulartopright.strokecolor=defaultcolor

        rectangularbottomleft.strokecolor=defaultcolor

        rectangularbottomright.strokecolor=defaultcolor

   

        rectangulartop.strokecolor=defaultcolor

        rectangularright.strokecolor=defaultcolor

        rectangularbottom.strokecolor=defaultcolor

        rectangularleft.strokecolor=defaultcolor

        

        rectangulartopleft.strokeweight=lineweightnormal

        rectangulartopright.strokeweight=lineweightnormal

        rectangularbottomleft.strokeweight=lineweightnormal

        rectangularbottomright.strokeweight=lineweightnormal

   

        rectangulartop.strokeweight=lineweightnormal

        rectangularright.strokeweight=lineweightnormal

        rectangularbottom.strokeweight=lineweightnormal

        rectangularleft.strokeweight=lineweightnormal     

    }

}

 

 

function momouse(){

    if(document.all&&window.print){

        mousepos_x=document.body.scrollLeft+event.clientX

        mousepos_y=document.body.scrollTop+event.clientY

   

        rectangulartopleft.from=mousepos_x+","+mousepos_y

        rectangulartopright.from=mousepos_x+","+mousepos_y

        rectangularbottomleft.from=mousepos_x+","+mousepos_y

        rectangularbottomright.from=mousepos_x+","+mousepos_y

   

        rectangulartop.from=mousepos_x+","+mousepos_y

        rectangularright.from=mousepos_x+","+mousepos_y

        rectangularbottom.from=mousepos_x+","+mousepos_y

        rectangularleft.from=mousepos_x+","+mousepos_y

     }

}

 

if(document.all&&window.print){

    document.body.className="disableHscroll"

    code="<v:line id=rectangulartopleft style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangulartopright style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularbottomleft style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularbottomright style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

 

    code+="<v:line id=rectangulartop style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularright style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularbottom style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularleft style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

 

    document.body.insertAdjacentHTML("afterBegin",code)

    document.onmousemove=momouse

    window.onload=initiateanimation

}

</SCRIPT>

<a href="http://www.7stk.com" onMouseOver="msover('#FFEEEE')" onMouseOut="msout()">网络时空</a>

2、脚本说明:

把如下代码加入<body>区域中

<STYLE>

.disableHscroll{

width:100%;overflow-x:hidden;overflow-y:scroll;

}

 

v\:* {

 BEHAVIOR: url(#default#VML)

}

</STYLE>

<SCRIPT>

// the default color of the 8 spiderlines

var defaultcolor="#F5F5F5"

 

// the width of the 8 spiderlines while highlighting textlinks (pixels)

var lineweighthighlight=14

 

// the width of the 8 spiderlines while NOT highlighting textlinks (pixels)

var lineweightnormal=2

 

///////////////////////////////////////////////////////////////////////////

// CONFIGURATION ENDS HERE

///////////////////////////////////////////////////////////////////////////

 

var distancetomouse=0

 

var mousepos_x=0

var mousepos_x=0

 

var marginleft=0

var margintop=0

var marginbottom=0

var marginright=0

 

var margincenterx

var margincentery

 

var mousepos_x=0

var mousepos_x=0

 

if (document.all&&window.print){

    document.write('<div id="bodycontent" style="position:relative">')

}

 

function initiateanimation(){

 

    marginbottom=document.body.clientHeight

    marginright=document.body.clientWidth

    margincenterx=Math.floor(marginright/2)

    margincentery=Math.floor(marginbottom/2)

   

    rectangulartopleft.to=marginleft+","+margintop

    rectangulartopright.to=marginright+","+margintop

    rectangularbottomleft.to=marginleft+","+marginbottom

    rectangularbottomright.to=marginright+","+marginbottom

   

    rectangulartop.to=margincenterx+","+margintop

    rectangularright.to=marginright+","+margincentery

    rectangularbottom.to=margincenterx+","+marginbottom

    rectangularleft.to=marginleft+","+margincentery

   

    rectangulartopleft.strokecolor=defaultcolor

    rectangulartopright.strokecolor=defaultcolor

    rectangularbottomleft.strokecolor=defaultcolor

    rectangularbottomright.strokecolor=defaultcolor

   

    rectangulartop.strokecolor=defaultcolor

    rectangularright.strokecolor=defaultcolor

    rectangularbottom.strokecolor=defaultcolor

    rectangularleft.strokecolor=defaultcolor

}

 

function msover(thiscolorhighlight){

    if(document.all&&window.print){

        rectangulartopleft.strokecolor=thiscolorhighlight

        rectangulartopright.strokecolor=thiscolorhighlight

        rectangularbottomleft.strokecolor=thiscolorhighlight

        rectangularbottomright.strokecolor=thiscolorhighlight

   

        rectangulartop.strokecolor=thiscolorhighlight

        rectangularright.strokecolor=thiscolorhighlight

        rectangularbottom.strokecolor=thiscolorhighlight

        rectangularleft.strokecolor=thiscolorhighlight

       

        rectangulartopleft.strokeweight=lineweighthighlight

        rectangulartopright.strokeweight=lineweighthighlight

        rectangularbottomleft.strokeweight=lineweighthighlight

        rectangularbottomright.strokeweight=lineweighthighlight

   

        rectangulartop.strokeweight=lineweighthighlight

        rectangularright.strokeweight=lineweighthighlight

        rectangularbottom.strokeweight=lineweighthighlight

        rectangularleft.strokeweight=lineweighthighlight

    }

}

 

function msout(){

    if(document.all&&window.print){

        rectangulartopleft.strokecolor=defaultcolor

        rectangulartopright.strokecolor=defaultcolor

        rectangularbottomleft.strokecolor=defaultcolor

        rectangularbottomright.strokecolor=defaultcolor

   

        rectangulartop.strokecolor=defaultcolor

        rectangularright.strokecolor=defaultcolor

        rectangularbottom.strokecolor=defaultcolor

        rectangularleft.strokecolor=defaultcolor

       

        rectangulartopleft.strokeweight=lineweightnormal

        rectangulartopright.strokeweight=lineweightnormal

        rectangularbottomleft.strokeweight=lineweightnormal

        rectangularbottomright.strokeweight=lineweightnormal

   

        rectangulartop.strokeweight=lineweightnormal

        rectangularright.strokeweight=lineweightnormal

        rectangularbottom.strokeweight=lineweightnormal

        rectangularleft.strokeweight=lineweightnormal     

    }

}

 

 

function momouse(){

    if(document.all&&window.print){

        mousepos_x=document.body.scrollLeft+event.clientX

        mousepos_y=document.body.scrollTop+event.clientY

   

        rectangulartopleft.from=mousepos_x+","+mousepos_y

        rectangulartopright.from=mousepos_x+","+mousepos_y

        rectangularbottomleft.from=mousepos_x+","+mousepos_y

        rectangularbottomright.from=mousepos_x+","+mousepos_y

   

        rectangulartop.from=mousepos_x+","+mousepos_y

        rectangularright.from=mousepos_x+","+mousepos_y

        rectangularbottom.from=mousepos_x+","+mousepos_y

        rectangularleft.from=mousepos_x+","+mousepos_y

     }

}

 

if(document.all&&window.print){

    document.body.className="disableHscroll"

    code="<v:line id=rectangulartopleft style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangulartopright style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularbottomleft style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularbottomright style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

 

    code+="<v:line id=rectangulartop style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularright style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularbottom style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

    code+="<v:line id=rectangularleft style='LEFT:0;POSITION:absolute;TOP:0;' strokeweight='"+lineweightnormal+"pt'></v:line>"

 

    document.body.insertAdjacentHTML("afterBegin",code)

    document.onmousemove=momouse

    window.onload=initiateanimation

}

</SCRIPT>

<a href="http://huicui.jimdo.com/" onMouseOver="msover('#FFEEEE')" onMouseOut="msout()">网页特效huicui.jimdo.com/</a>

 

0 Comments

Tue

17

Mar

2009

123、鼠标消息提示代码

123、鼠标消息提示代码

脚本说明:

把如下代码加入<body>区域中

<div style="position:absolute;z-index:1;visibility:hide" id="overDiv"></div>

<script language="JavaScript">

<!--

ns4 = (document.layers)? true:false

ie4 = (document.all)? true:false

if (ie4) {

if (navigator.userAgent.indexOf('MSIE 5')>0) {

ie5 = true;

}

else {

ie5 = false;

}

}

else {

ie5 = false;

}

var x = 0;

var y = 0;

var snow = 0;

var sw = 0;

var cnt = 0;

var dir = 1;

if ( (ns4) || (ie4) ) {

if (ns4) over = document.overDiv

if (ie4) over = overDiv.style

document.onmousemove = mouseMove

if (ns4) document.captureEvents(Event.MOUSEMOVE)

}

function drc(text, title, osy) {

dtc(1, text, title, osy);

}

function dlc(text, title, osy) {

dtc(0, text, title, osy);

}

function dcc(text, title, osy) {

dtc(2, text, title, osy);

}

function nd() {

if ( cnt >= 1 ) { sw = 0 };

if ( (ns4) || (ie4) ) {

if ( sw == 0 ) {

snow = 0;

hideObject(over);

}

else {

cnt++;

}

}

}

function dtc(d, text, title, osy) {

txt = text

layerWrite(txt);

dir = d;

offsety = osy;

disp();

}

function disp() {

if ( (ns4) || (ie4) ) {

if (snow == 0) {

if (dir == 2) {

moveTo(over,x,y+10);

}

if (dir == 1) {

moveTo(over,x,y+10);

}

if (dir == 0) {

moveTo(over,x,y+10);

}

showObject(over);

snow = 1;

}

}

}

function mouseMove(e) {

if (ns4) {x=e.pageX; y=e.pageY;

}

if (ie4) {x=event.x; y=event.y;

}

if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;

}

if (snow) {

if (dir == 2) {

moveTo(over,x,y+10);

}

if (dir == 1) {

moveTo(over,x,y+10);

}

if (dir == 0) {

moveTo(over,x,y+10);

}

}

}

function cClick() {

hideObject(over);

sw=0;

}

function layerWrite(txt) {

if (ns4) {

var lyr = document.overDiv.document

lyr.write(txt)

lyr.close()

}

else if (ie4) document.all["overDiv"].innerHTML = txt

}

function showObject(obj) {

if (ns4) obj.visibility = "show"

else if (ie4) obj.visibility = "visible"

}

function hideObject(obj) {

if (ns4) obj.visibility = "hide"

else if (ie4) obj.visibility = "hidden"

}

function moveTo(obj,xL,yL) {

obj.left = xL

obj.top = yL

}

//-->

</script>

<p>| <a href="middle.htm" target="main" onmouseover="dcc('<div style=margin-left:10;margin-top:10>有更新日志的首页~</div>','','20')" onmouseout="nd()">main</a> | mos | profile |

<a href="http://www.7stk.com" target="main" onmouseover="dcc('<div style=margin-left:10;margin-top:10>新闻、工作日程、站长公告~</div>','','20')" onmouseout="nd()">event</a> | <a href="#" target="main" onmouseover="dcc('<div style=margin-left:10;margin-top:10>我自己收藏的像册~</div>','','20')" onmouseout="nd()">gallery</a> | fanart | audio |

<a href="http://www.7stk.com" target="main" onmouseover="dcc('<div style=margin-left:10;margin-top:10>贴图区~</div>','','20')" onmouseout="nd()">p.d.s</a> | <a href="http://www.7stk.com" target="main" onmouseover="dcc('<div style=margin-left:10;margin-top:10>影像下载区~</div>','','20')" onmouseout="nd()">video</a> |

<a href="http://www.7stk.com" target="main" onmouseover="dcc('<div style=margin-left:10;margin-top:10>自由讨论区~</div>','','20')" onmouseout="nd()">freebbs</a> | links |

</p> 

 

0 Comments

Tue

17

Mar

2009

122、鼠标右键消息框

122、鼠标右键消息框

脚本说明:

第一步:把如下代码加入<body>区域中

<script language=javascript>

function aa()

{ab.style.display=""

ab.style.left=window.event.clientX

ab.style.top=window.event.clientY

}</script>

<div id=ab style="position:absolute;width:80;height:80;background-color:blue;display:none"><font color=white>点击左键后就会出现这个提示小窗口......</div>

 

 

第二步:请把<body>中的内容改为:

<body bgcolor="#fef4d9" onmousedown=aa()>

 

0 Comments

Tue

17

Mar

2009

121、鼠标彩色轨迹特效

121、鼠标彩色轨迹特效

脚本说明:

把如下代码加入<body>区域中

<script language="JavaScript">

<!--

colours=new Array('#ffffff','#ff0000','#00ff00','#ffffff','#ff00ff','#ffa500','#fff000','#0000ff','#ffffff')

 

y = 0;

x = 0;

n6=(document.getElementById&&!document.all);

ns=(document.layers);

ie=(document.all);

d=(ns||ie)?'document.':'document.getElementById("';

a=(ns||n6)?'':'all.';

n6r=(n6)?'")':'';

s=(ns)?'':'.style';

n=(n6)?9:10;

if (ns){

for (i = 0; i < n; i++)

document.write('<layer name="dots'+i+'" top=0 left=0 width='+i/2+' height='+i/2+' bgcolor=#ff0000></layer>');

}

if (ie)

document.write('<div id="con" style="position:absolute;top:0px;left:0px"><div style="position:relative">');

if (ie||n6){

for (i = 0; i < n; i++)

document.write('<div id="dots'+i+'" style="position:absolute;top:0px;left:0px;width:'+i/2+'px;height:'+i/2+'px;background:#ff0000;font-size:'+i/2+'"></div>');

}

if (ie)

document.write('</div></div>');

 

 

 

 

(ns||n6)?window.captureEvents(Event.MOUSEMOVE):0;

function Mouse(evnt){

y = (ns||n6)?evnt.pageY+4 - window.pageYOffset:event.y+4;

x = (ns||n6)?evnt.pageX+1:event.x+1;

}

(ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;

 

function animate(){

h=(ns||n6)?window.innerHeight:document.body.clientHeight;

w=(ns||n6)?window.innerWidth:document.body.clientWidth;

 

o=(ns||n6)?window.pageYOffset:0;

if (ie)con.style.top=document.body.scrollTop;

for (i = 0; i < n; i++){

var temp1 = eval(d+a+"dots"+i+n6r+s);

var randcolours = Math.floor(Math.random()*colours.length);

(ns)?temp1.bgColor = colours[randcolours]:temp1.background = colours[randcolours];

if (i < n-1){

 var temp2 = eval(d+a+"dots"+(i+1)+n6r+s);

 temp1.top = parseInt(temp2.top);

 temp1.left = parseInt(temp2.left);

 }

else{

 temp1.top = y+o;

 temp1.left = x;

 }

if ((y < h/10) || (y > h-h/10) || (x < w/10) || (x > w-w/10)){

var temp3 = eval(d+a+"dots"+0+n6r+s);

temp3.top = (y-25)+Math.random()*50;

temp3.left = (x-25)+Math.random()*50;

temp2.top = parseInt(temp3.top)+o;

temp2.left = parseInt(temp3.left);

}

}

setTimeout("animate()",30);

}

animate();

// -->

</script>

 

0 Comments