摘要: 小括号 JavaScript中小括号有五种语义 语义1,函数声明时参数表 function func(arg1,arg2){ // ... } 语义2,和一些语句联合使用以达到某些限定作用 // 和for in一起使用 for(var a in obj){ // ... } // 和if一起使用 if(boo){ //... } // 和while一起使用 while(boo){ // ... } // 和do while一起使用 do{ // ... } ... 阅读全文
posted @ 2012-06-29 13:49 wangchao 阅读(4212) 评论(0) 推荐(1) 编辑
摘要: 思路很简单,就是在一个函数中调用不停执行自己,有点像递归 复制代码 代码如下:<script language="javascript" type="text/javascript"> var i = 0; function test() { if (i >10) {return; } setTimeout("test()", 2000); if(i!=0) alert(i); i += 1; //用这个也可以 //setTimeout(test,2000); } function window.onload() { 阅读全文
posted @ 2012-05-24 00:20 wangchao 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 学习source,看到了下面一段代码try { Thread.sleep(2000); } catch (InterruptedException e) {}首先这段代码的作用是使当前进程沉睡2S,展现给用户的结果就是画面维持两秒,有个“正在启动”的感觉而已。其实,之前还有看到过sleep(0)的时候,这又是什么作用呢?百度之,搜到一篇超有趣的讲解,贴过来,备忘。PS.期待有一天,我也有这能力,把恶心巴拉的东西搞得这么有趣味。我们可能经常会用到 Thread.Sleep 函数来使线程挂起一段时间。那么你有没有正确的理解这个函数的用法呢?思考下面这两个问题: 1、假设现在是 2008-4-7 1 阅读全文
posted @ 2012-05-23 23:18 wangchao 阅读(1719) 评论(0) 推荐(1) 编辑
摘要: JS中offsetTop、clientTop、scrollTop、offsetTop各属性介绍2010-12-31 9:24这里是javascript中制作滚动代码的常用属性页可见区域宽: document.body.clientWidth;网页可见区域高: document.body.clientHeight;网页可见区域宽: document.body.offsetWidth (包括边线的宽);网页可见区域高: document.body.offsetHeight (包括边线的宽);网页正文全文宽: document.body.scrollWidth;网页正文全文高: document.b 阅读全文
posted @ 2012-05-22 10:26 wangchao 阅读(176) 评论(0) 推荐(0) 编辑
摘要: “唯一性约束”和“唯一性索引”是不同的。 一、 建立唯一性约束的语法,使用create table或者alter table 1. 在字段级约束定义-- 命名 create table tmp_table ( a int constraint pk_tmp_table_a primary key, b varchar(10) constraint uq_tmp_table_b unique ) -- 不命名 create table tmp_table ( a int primary key, b varchar(10) unique ) 2. 在表约束定义-- 命名 create ta... 阅读全文
posted @ 2012-05-20 21:31 wangchao 阅读(1555) 评论(0) 推荐(0) 编辑
摘要: 摘自MSDN:“CREATE INDEX (Transact-SQL) ” 为指定表或视图创建关系索引,或为指定表创建 XML 索引。可在向表中填入数据前创建索引。可通过指定限定的数据库名称,为另一个数据库中的表或视图创建索引。create index indexName on tableName(colName) with (options)这样创建的为 non unique ,nonclustered 索引 UNIQUE :为表或视图创建唯一索引。唯一索引不允许两行具有相同的索引键值。视图的聚集索引必须唯一。默认为non unique CLUSTERED:创建索引时,键值的逻辑顺序决定表中 阅读全文
posted @ 2012-05-20 21:09 wangchao 阅读(1485) 评论(0) 推荐(0) 编辑
摘要: class Program { static void Main() { //构造一个嵌套字典 Dictionary<int, Dictionary<int, string>> dicExternal = new Dictionary<int, Dictionary<int, string>>(); for (int i = 90; i > 65; i = i - 5) { Dictionary<int, string> dicInternal = new Dictionary<int, string>(); for 阅读全文
posted @ 2012-05-18 23:48 wangchao 阅读(2977) 评论(0) 推荐(0) 编辑
摘要: class Program { static void Main() { string[] s = new string[6] { "浏览器类_Firefox", "浏览器类_IE", "文字处理_Word", "文字处理_WPS", "电子地图_google地图", "电子地图_百度地图" }; Dictionary<string, List<string>> kk = new Dictionary<string, List<string 阅读全文
posted @ 2012-05-18 23:46 wangchao 阅读(611) 评论(0) 推荐(0) 编辑
摘要: 网上看到的,记录下来,供参考,备忘Dictionary<string,int> list =newDictionary<string,int>(); list.Add("d", 1);//3.0以上版本foreach(variteminlist) {Console.WriteLine(item.Key + item.Value); }//KeyValuePair<T,K>foreach(KeyValuePair<string,int> kvinlist) {Console.WriteLine(kv.Key + kv.Value 阅读全文
posted @ 2012-05-17 08:09 wangchao 阅读(67708) 评论(0) 推荐(0) 编辑
摘要: 网上数组定义很多讲解,感觉很零散,这里总结一下,备忘class Program { static void Main(string[] args) { //1.声明并初始化数组大小 //string[] array = new string[3]; //for (int i = 0; i < 3; i++) //{ // array[i] = "a"+i.ToString(); //} //2.声明并初始化数组的值 //string[] array = { "a1", "a2", "a3" }; //3.声明 阅读全文
posted @ 2012-05-16 23:17 wangchao 阅读(377) 评论(0) 推荐(0) 编辑