<!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. Autumn is a second spring when every leaf is a flower.

    Autumn is a second spring when every leaf is a flower. 秋天即是第二个春天,每片叶子都是花朵.——阿尔贝·加缪

  2. 自己动手写ORM框架

    提起ORM框架,大家都很熟悉,网上流行的ORM框架有很多,其中出名的有一些,不出名的更是数不胜数. 下面是自己实现的一个简单的ORM框架,实现了常用的增删查改功能,供大家研究ORM实现原理. 功能描述 ...

  3. Logstash学习-Hello World

    1.安装 rpm --import http://packages.elasticsearch.org/GPG-KEY-elasticsearchcat > /etc/yum.repos.d/l ...

  4. php大小写转换

    1.将字符串转换成小写   strtolower();: 该函数将传入的字符串参数所有的字符都转换成小写,并以小定形式放回这个字符串.例: <?php $str = "I want T ...

  5. c++源文件后缀名

    C中: 头文件后缀名: .h 源文件后缀名: .c C++中: 头文件后缀名: .h,   .hpp,   .hxx 源文件后缀名:.cpp,   .cc,   .cxx,   .C   .c++ 现 ...

  6. SQL Server2014,附加数据库失败,错误为:5120的解决方法

    在SQL Server 2014附加数据库的时候,报错为: 无法打开物理文件XXX,操作系统错误5(拒绝访问),SQL Server 错误5120 解决方法:  我的电脑→管理→服务和应用程序→ 服务 ...

  7. EditText光标颜色设置

    又一次做应用,发现EditText没有显示光标,借鉴了网上的方法,发现是因为光标是白色的,与背景一样造成的,这里记录一下如何设置EditText等的光标颜色: 需要在布局文件中指定androd:tex ...

  8. Xcode5中如何切换Storyboards为xib

    在Xcode5中,当创建一个带View的iPhone项目时,默认必须使用Storyboards,不再支持切换xib的checkbox.本文讲解如何手动切换到使用xib来布局. 1,把Main.stor ...

  9. JAVA模拟HTTP post请求上传文件

    在开发中,我们使用的比较多的HTTP请求方式基本上就是GET.POST.其中GET用于从服务器获取数据,POST主要用于向服务器提交一些表单数据,例如文件上传等.而我们在使用HTTP请求时中遇到的比较 ...

  10. juqery模板 Templates

    现在已经有了许多JavaScript的解决方案模板,从这方面说,标准化的模板解决方案必然是大势所趋.在本节中,我们向你简要描述四个最流行最有趣的模板.现有的模板解决方案能解决什么?那些特色在jQuer ...