<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>防W8系统屏保</title> <script>
(JS={
$:function(o){return typeof o=="string"?document.getElementById(o):o},
dingwei:false,
shubiao:0,
weizhi:0,
on:function(o,type,fn){o.attachEvent?o.attachEvent('on'+type,function(){fn.call(o)}):o.addEventListener(type,fn,false);return JS.on}, fn1:function(o,attr){
e= arguments.callee.caller.arguments[0]||window.event;
var b=e.clientY this.shubiao=b;
this.dingwei=true;
this.weizhi=parseInt(o.style[attr]) clearInterval(o["ll"])
}, fn2:function(o,attr){
if(this.dingwei){
var d= arguments.callee.caller.arguments[0]||window.event;
var dd=d.clientY-this.shubiao;
var cc=this.weizhi+dd;
if( dd<=0){
o.style[attr]=cc+"px"
}
}
}, fn3:function(o,attr){
this.dingwei=false;
var gg=parseInt(o.style[attr]);
clearInterval(o["ll"]);
if(gg<-300)
{
o["ll"]=setInterval(function(){ gg-=5; o.style[attr]=gg+"px"; if(gg<-(screen.height)){
clearInterval(o["ll"])
}
},10)
}
else if(gg>=-300&&gg<-5){
o["ll"]=setInterval(function(){ gg+=5; o.style[attr]=gg+"px"; if(gg>=-5){
clearInterval(o["ll"])
}
},10)
}
}, }).on(window,"load",function(){
var Q=JS.$("bb");
JS.on(Q,"mousedown", function(){ JS.fn1(Q,"top")})
(Q,"mousemove",function(){ JS.fn2(Q,"top")})
(Q,"mouseup",function(){JS.fn3(Q,"top")})
(Q,"mouseout",function(){JS.fn3(Q,"top")})
}) </script>
</head>
<body>
<div id="bb" style=" position:absolute; top:0px; left:0px; width:100%;height:100%; cursor:pointer; background-color:#06F;">
</div>
</body></html>

面向对象:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head> <script type="text/javascript">
function WP8(id){
var $this=this;
this.kongzhi=false;
this.cY1=null;
this.cY2=null;
this.weizhi=null;
this.oid=document.getElementById(id);
this.oid.onmousedown=function(e){var e=e||window.event; $this.cY1=e.clientY;$this.fn1()};
this.oid.onmousemove=function(e){var e=e||window.event; $this.cY2=e.clientY;$this.fn2()};
this.oid.onmouseup=function(){$this.fn3()};
this.oid.onmouseout=function(){$this.fn3()};
}; WP8.prototype.fn1=function(){
this.kongzhi=true;
this.weizhi=parseInt(this.oid.style["top"]);
}; WP8.prototype.fn2=function(){
if(this.kongzhi&&(this.cY2-this.cY1)<0){
this.oid.style["top"]=this.weizhi+(this.cY2-this.cY1)+"px";
} }; WP8.prototype.fn3=function(){
this.kongzhi=false;
var this1=this
var gg=parseInt(this.oid.style["top"]);
clearInterval(this['qingchu']);
if(gg<-300){ this['qingchu']=setInterval(function(){
gg-=5;
this1.oid.style["top"]=gg+"px"; if(gg<-(screen.height)){clearInterval(this1['qingchu']);} },10) } else if(gg>=-300&&gg<-5){
this['qingch']=setInterval(function(){ gg+=5;
this1.oid.style["top"]=gg+"px"; if(gg>=0){clearInterval(this1['qingch']);}
},10 ) } }; window.onload=function(){ new WP8("bb")
}
</script>
<body> <div id="bb" style=" position:absolute; top:0px; left:0px; width:100%;height:100%; cursor:pointer; background-color:#06F;"> </div>
</body>
</html>

仿W8屏保的更多相关文章

  1. 一个仿windows泡泡屏保的实现

    一个仿windows泡泡屏保的实现 有天看到有人在百度知道上问windows 泡泡屏保该怎么用C#做,一时有趣,就做了一个出来,对于其中几个要点总结如下: 一,屏保程序的制作要求 屏保程序的扩展名是. ...

  2. C#制作简易屏保

    前言:前段时间,有个网友问我C#制作屏保的问题,我瞬间懵逼了(C#还可以制作屏保!).于是我去查阅相关资料,下面把C#如何制作屏保的过程及我学习过程的心得也记录下来,希望对需要的人能有帮助. 基本思路 ...

  3. Linux关闭休眠和屏保模式

    本人因为特殊需求,想让某台Linux主机始终显示某个程序,显示器不能关机或者休眠或进入屏保模式. 环境:Ubuntu 11.10 最小化模式安装并安装有轻量级桌面openbox(非gnome).因为X ...

  4. [AIR] AS3.0设置屏保功能

    package com.controls { import flash.desktop.NativeApplication; import flash.events.Event; import fla ...

  5. Win XP 如何禁用屏保

    如果你试过 “在桌面空白处点击右键-[属性]-[屏幕保护程序],选择[无],点击[确定]”后,当时是可以去掉屏保.但如果重启计算机或者从待机状态唤醒后,屏保依然会出现,那么你可以试试下面的方法. 首先 ...

  6. wpf 制作播放视频的屏保程序、而且能分屏显示

    这个程序用到了WPF里  “visual_Brush”(主要是为了实现分屏显示) , “UserControl” ,这两个知识点: 在屏保状态下播放指定文件夹下的视频,而且能分屏显示: 把编译好的屏保 ...

  7. C#制作简易屏保(转)

    C#制作简易屏保[原创] 原始网址: http://www.cnblogs.com/drizzlecrj/archive/2006/10/06/522182.html 2006-10-06 16:25 ...

  8. python写的屏保程序

    __author__ = 'ChenYan' from random import randint from tkinter import * class Randball(): def __init ...

  9. Android - Daydream 互动屏保

    Android Daydream 互动屏保 API19 API23 Create:2016-03-01 继承DreamService来实现一个自定义屏保 Dreams是当充电的设备空闲,或者插入底座时 ...

随机推荐

  1. 取字符串拼音首字母(js)

    //取字符串拼音首字母 function makePy(str) { if (typeof(str) != "string") throw new Error(-1, " ...

  2. git管理测试生产环境代码

    利用post-update实现简单钩子 #!/bin/bash cd /www/test || exit #进入指定的目录 unset GIT_DIR #清楚环境变量 git checkout mas ...

  3. JAVA实现国际化

    1 Java国际化的思路 Java程序的国际化的思路是将程序中的标签.提示等信息放在资源文件中,程序需要支持哪些国家.语言环境,就对应提供相应的资源文件.资源文件是key-value对,每个资源文件中 ...

  4. JavaScript---function、this关键字相关习题

    1. 请看下列代码: function F( ){ function C( ){ return this; } return C(); } var o=new F( ); 请问上面的this值指向的是 ...

  5. gulp编译sass

    前言:前段时间学习了sass语法,但是一直用的是"考拉"这个软件工具将我写的sass代码编译成css,然后再引用到项目里面去的,随着对sass的更加深入的了解,我开始尝试着将sas ...

  6. mysql xml 参数

    drop PROCEDURE IF EXISTS tt;CREATE PROCEDURE tt(para text,OUT para1 DECIMAL(18, 6),OUT para2 DECIMAL ...

  7. Corn Fields——POJ3254状态压缩Dp

    Corn Fields Time Limit: 2000MS Memory Limit: 65536K Description Farmer John has purchased a lush new ...

  8. Java的日期工具类

    package com.tech.jin.util; import java.text.DateFormat; import java.text.ParseException; import java ...

  9. angular 控制器的使用两种模式

    angular.module("myApp",[]) .controller("firstCtrl",["$scope",function( ...

  10. hibernate联合主键 注解方式

    转载自https://my.oschina.net/yotoo/blog/265571 方法一:主键类用@Embeddable,pojo类仍然用@Entity但是引用主键类的对象用@Id 主键pojo ...