鼠标有关JavaScript事件
<script>
var times = 0;
var ms = new Date();
var prex =0;
var pretoright=false;
var level =0;
function trackEarthQuake(){
var curx = event.screenX;
var toright ;
if(curx>prex){
level += curx-prex;
toright=true;
} else {
toright=false;
}
prex = curx;
if(pretoright!=toright){
times ++;
}
pretoright=toright;
var curms=new Date();
if(times>=10){
times=0;
intervalms = curms-ms;
if(intervalms<=1600){
alert("有地震!快跑!地震级别为"+Math.round(Math.log(level)));
}
ms=curms;
level=0;
}
}
</script>
<body onmousemove="trackEarthQuake()">
</body>
相关文档:
alert(parseInt("101101", 2))
运行代码
function toBin(intNum) {
var answer = "";
if(/\d+/.test(intNum)) {
while(intNum != 0) {
answer = Math.abs(intNum%2)+answer;
intNum = parseInt(intNum/2);
}
......
JavaScript 是 Web 开发与设计中不可或缺的东西,不管是一个简单的网页还是一个专业的站点,也不管你是高手还是菜鸟,如今 JavaScript
库越来越强大,可以胜任许多复杂的工作,然而同时,人们在众多 JavaScript 库面前又觉得无所适从,本文,我们将使用 Google 搜索出排名前 10 位的
JavaScript 库,并对它们逐一 ......
例如:有三个类classX,classY,classZ
classZ分别继承classX和classY
于是就有下面的写法:
function ClassZ(){
this.newMethod=classX;
this.newMethod();
delete this.newMethod;
this.newMethod=classY;
this.newMethod();
delete this.newMethod;
}
这种写法存在一个弊端.。如果classX和classY有具有同名的属 ......
if (document.all)
{
yourLogo = "欢迎进入鲜花工坊网!"; <!--待旋转的文字-->
logoFont = "Arial";   ......
var OnPasteCheckIntNum = function()
{
if(window.clipboardData)
{
if(isNaN(window.clipboardData.getData('text')))
{
......