Javascript

用fason的参数化定时器在javascript中模拟多线程

原帖子发表在http://community.csdn.net/Expert/TopicView.asp?id=4069144author:emu(黄希彤)有csdn的朋友把http://community.csdn.net/Expert/TopicView.asp?id=3191873给翻了出来,这样在javascript中模拟多线程又有了更漂亮的做法了:1emu--用fason的参数化定时器模拟多线程</title</span> <p class="auth-span"> <span class="muted"><i class="fa fa-user"></i><span class="zj-icon-text">系统</span></span> <span class="muted"><i class="fa fa-clock-o"></i><span class="zj-icon-text">2019-08-29 23:22:52</span></span> <span class="muted"><i class="fa fa-eye"></i><span class="zj-icon-text">1732</span></span> <!-- <span class="muted"><i class="fa fa-comments-o"></i> <a target="_blank" href="https://cuiqingcai.com/7080.html#respond">0评论</a></span> <span class="muted"> <a href="javascript:;" class="action zj-addlike"><i class="fa fa-heart-o"></i><span class="count">16</span>喜欢</a></span>--> </p> </article><article class="excerpt"> <header> <a title="Javascript" class="label label-important zj-del-target" href="/category/66">Javascript<i class="label-arrow"></i></a> <h2> <a class="zj-titles zj-del-target" href="/article/11811" title="全面理解javascript的caller,callee,call,apply" target="_blank" onclick="return recordId('cid',66)">全面理解javascript的caller,callee,call,apply </a> </h2> </header> <div class="focus"> <a class="zj-del-target" href="/article/11811" target="_blank"><img style="width: 200px; height: 123px;" class="thumb" src="/Public/static/images/article/7.jpg" alt="" title=""></a> </div> <span class="note" onclick="if (jq.browser.versions.mobile) {window.location.href='/article/11811';}else{window.open('/article/11811');}" style="cursor: pointer;">在提到上述的概念之前,首先想说说javascript中函数的隐含参数:argumentsArguments该对象代表正在执行的函数和调用它的函数的参数。[function.]arguments[n]参数function:选项。当前正在执行的Function对象的名字。n:选项。要传递给Function对象的从0开始的参数值索引。说明Arguments是进行函数调用时,除了指定的参数外,还另外创建的一个隐藏对象。Arguments是一个类似数组但不是数组的对</span> <p class="auth-span"> <span class="muted"><i class="fa fa-user"></i><span class="zj-icon-text">系统</span></span> <span class="muted"><i class="fa fa-clock-o"></i><span class="zj-icon-text">2019-08-12 09:29:58</span></span> <span class="muted"><i class="fa fa-eye"></i><span class="zj-icon-text">1731</span></span> <!-- <span class="muted"><i class="fa fa-comments-o"></i> <a target="_blank" href="https://cuiqingcai.com/7080.html#respond">0评论</a></span> <span class="muted"> <a href="javascript:;" class="action zj-addlike"><i class="fa fa-heart-o"></i><span class="count">16</span>喜欢</a></span>--> </p> </article><article class="excerpt"> <header> <a title="Javascript" class="label label-important zj-del-target" href="/category/66">Javascript<i class="label-arrow"></i></a> <h2> <a class="zj-titles zj-del-target" href="/article/14775" title="javascript小技巧" target="_blank" onclick="return recordId('cid',66)">javascript小技巧 </a> </h2> </header> <div class="focus"> <a class="zj-del-target" href="/article/14775" target="_blank"><img style="width: 200px; height: 123px;" class="thumb" src="/Public/static/images/article/11.jpg" alt="" title=""></a> </div> <span class="note" onclick="if (jq.browser.versions.mobile) {window.location.href='/article/14775';}else{window.open('/article/14775');}" style="cursor: pointer;">事件源对象event.srcElement.tagNameevent.srcElement.type捕获释放event.srcElement.setCapture();event.srcElement.releaseCapture();事件按键event.keyCodeevent.shiftKeyevent.altKeyevent.ctrlKey事件返回值event.returnValue鼠标位置event.xevent.y窗体活动元素document.a</span> <p class="auth-span"> <span class="muted"><i class="fa fa-user"></i><span class="zj-icon-text">系统</span></span> <span class="muted"><i class="fa fa-clock-o"></i><span class="zj-icon-text">2019-08-29 22:19:59</span></span> <span class="muted"><i class="fa fa-eye"></i><span class="zj-icon-text">1728</span></span> <!-- <span class="muted"><i class="fa fa-comments-o"></i> <a target="_blank" href="https://cuiqingcai.com/7080.html#respond">0评论</a></span> <span class="muted"> <a href="javascript:;" class="action zj-addlike"><i class="fa fa-heart-o"></i><span class="count">16</span>喜欢</a></span>--> </p> </article><article class="excerpt"> <header> <a title="Javascript" class="label label-important zj-del-target" href="/category/66">Javascript<i class="label-arrow"></i></a> <h2> <a class="zj-titles zj-del-target" href="/article/17777" title="json(javascript object natation)" target="_blank" onclick="return recordId('cid',66)">json(javascript object natation) </a> </h2> </header> <div class="focus"> <a class="zj-del-target" href="/article/17777" target="_blank"><img style="width: 200px; height: 123px;" class="thumb" src="/Public/static/images/article/3.jpg" alt="" title=""></a> </div> <span class="note" onclick="if (jq.browser.versions.mobile) {window.location.href='/article/17777';}else{window.open('/article/17777');}" style="cursor: pointer;">什么是json?JSON即JavaScriptObjectNatation,它是一种轻量级的数据交换格式,非常适合于服务器与JavaScript的交互。本文将快速讲解JSON格式,并通过代码示例演示如何分别在客户端和服务器端进行JSON格式数据的处理。<!----><!----><!---->尽管有许多宣传关于XML如何拥有跨平台,跨语言的优势,然而,除非应用于WebServices,否则,在普通的Web应用中,开发者经常为XML的解析伤透了脑筋,无论是服</span> <p class="auth-span"> <span class="muted"><i class="fa fa-user"></i><span class="zj-icon-text">系统</span></span> <span class="muted"><i class="fa fa-clock-o"></i><span class="zj-icon-text">2019-08-29 22:57:56</span></span> <span class="muted"><i class="fa fa-eye"></i><span class="zj-icon-text">1724</span></span> <!-- <span class="muted"><i class="fa fa-comments-o"></i> <a target="_blank" href="https://cuiqingcai.com/7080.html#respond">0评论</a></span> <span class="muted"> <a href="javascript:;" class="action zj-addlike"><i class="fa fa-heart-o"></i><span class="count">16</span>喜欢</a></span>--> </p> </article><article class="excerpt"> <header> <a title="Javascript" class="label label-important zj-del-target" href="/category/66">Javascript<i class="label-arrow"></i></a> <h2> <a class="zj-titles zj-del-target" href="/article/14473" title="My javascript utils" target="_blank" onclick="return recordId('cid',66)">My javascript utils </a> </h2> </header> <div class="focus"> <a class="zj-del-target" href="/article/14473" target="_blank"><img style="width: 200px; height: 123px;" class="thumb" src="/Public/static/images/article/14.jpg" alt="" title=""></a> </div> <span class="note" onclick="if (jq.browser.versions.mobile) {window.location.href='/article/14473';}else{window.open('/article/14473');}" style="cursor: pointer;">/**//*Thisfunctionisusetocheckthelengthwhethercurrentlengthisoverflowthedesignatedlength,oncontrolgetfocusoronkeyup*ctrlId:targetcontrol*return:maxlength*/functionlengthCheck(ctrlId,max)...{varoControl=ctrlId;varoX=getAbsoluteLeft</span> <p class="auth-span"> <span class="muted"><i class="fa fa-user"></i><span class="zj-icon-text">系统</span></span> <span class="muted"><i class="fa fa-clock-o"></i><span class="zj-icon-text">2019-08-29 22:16:23</span></span> <span class="muted"><i class="fa fa-eye"></i><span class="zj-icon-text">1720</span></span> <!-- <span class="muted"><i class="fa fa-comments-o"></i> <a target="_blank" href="https://cuiqingcai.com/7080.html#respond">0评论</a></span> <span class="muted"> <a href="javascript:;" class="action zj-addlike"><i class="fa fa-heart-o"></i><span class="count">16</span>喜欢</a></span>--> </p> </article><article class="excerpt"> <header> <a title="Javascript" class="label label-important zj-del-target" href="/category/66">Javascript<i class="label-arrow"></i></a> <h2> <a class="zj-titles zj-del-target" href="/article/20108" title="javascript做二级联动" target="_blank" onclick="return recordId('cid',66)">javascript做二级联动 </a> </h2> </header> <div class="focus"> <a class="zj-del-target" href="/article/20108" target="_blank"><img style="width: 200px; height: 123px;" class="thumb" src="/Public/static/images/article/13.jpg" alt="" title=""></a> </div> <span class="note" onclick="if (jq.browser.versions.mobile) {window.location.href='/article/20108';}else{window.open('/article/20108');}" style="cursor: pointer;"><%...@pagecontentType="text/html;charset=UTF-8"%><html><head><title>Thisisatest!请选择

系统 2019-08-29 23:28:22 1716

Javascript

Javascript引用指针

Quiz请尝试完成下列完形填空:/*创建一个队列,头为head0,尾为tail0*/functionIntList(head0,tail0){this.head=head0||0;this.tail=tail0||null;}/*返回一个IntList包含数组中的所有数*/IntList.list=function(__args){varsentinel=newIntList(),len=__args.length,p;p=sentinel;for(var

系统 2019-08-12 01:32:09 1716

Javascript

javascript 中关于select 的应用和相关操作

1检测是否有选中if(objSelect.selectedIndex>-1){//说明选中}else{//说明没有选中}2删除被选中的项objSelect.options[objSelect.selectedIndex]=null;3增加项objSelect.options[objSelect.length]=newOption("你好","hello");4修改所选择中的项objSelect.options[objSelect.selectedIndex

系统 2019-08-29 22:59:43 1706

Javascript

Event delegation in JavaScript

EventdelegationinJavaScriptPostedatJune30,200909:00ambyNicholasC.ZakasTags:Delegation,DOM,Events,JavaScript,PerformanceLastweek,IspokeatandattendedtheVelocitywebperformanceconferenceinSanJose.ItwasalotoffunandIlearnedalotintheothe

系统 2019-08-12 09:30:22 1705

Javascript

十个开源的Javascript框架

下面是十个最牛的也是最流行的Javascript框架。它们完全可以担任目前世界上几乎所有一些和Ajax技术相关的和图形界面相关的一切功能。jQueryhttp://jquery.com/如果今天你还不知道jQuery的话,那么作为一个程序员你可能真的是从火星来的了。这恐怕是Ajax中应用最广的框架。包括了许多很不错的UI组件,做出网页的效果也是令人称道的。不过,他最牛的是它的文件大小,只有区区18K,实在是居家旅行,网站开发之首选。下面是一个日历控件,很不

系统 2019-08-29 22:49:01 1701

Javascript

css+javascript 无限级菜单

演示:http://www.cssrain.cn/demo/ddlevelsmenu/demo.htmhttp://www.cssrain.cn/demo/ddlevelsmenu/demo2.htm下载:http://www.cssrain.cn/demo/ddlevelsmenu/ddlevelsmenu.rarcss+javascript无限级菜单

系统 2019-08-29 22:03:50 1688

Javascript

JavaScript 中的内存泄露模式

知道内存泄漏的起因,那么在JavaScript中进行相应的防范就应该相当容易。在这篇文章中,作者KiranSundar和AbhijeetBhattacharya将带您亲历JavaScript中的循环引用的全部基本知识,向您介绍为何它们会在某些浏览器中产生问题,尤其是在结合了闭包的情况下。在了解了您应该引起注意的常见内存泄漏模式之后,您还将学到应对这些泄漏的诸多方法。JavaScript是用来向Web页面添加动态内容的一种功能强大的脚本语言。它尤其特别有助于

系统 2019-08-12 09:30:16 1686

Javascript

Ophone: Widget 介绍(采用HTML、JavaScript和C

Widget介绍在OPhone平台中,Widget应用采用了JIL(JointInnovationLab)Widget标准。JILWidget是一个采用HTML、JavaScript和CSS等网络技术的应用程序。Widget应用是在Widget引擎上运行的独立的应用程序。Widget已经成为手机上非常流行的技术,可以为用户带来良好的移动互联网体验,随时随地获取有用的资讯,如天气预报、股票信息、头条新闻等。从用户的角度来看,Widget应用和OPhone应用

系统 2019-08-29 22:52:17 1682

Javascript

javaScript 语法错误!

javaScript使用经常会出现语法错误什么未定义!其实的确由于我们编辑代码不规范,缺;少或多了(/)大小写等问题!还有就是缺少对象啊!其实这主要是由于调用的js函数不存在,或者笔误造成函数不识别等原因onMouseOver/Out是用来改变变换表格背景色,现在用不上,对应的js文件也修改了

系统 2019-08-29 23:49:29 1681