安装ubuntu9.10, 本以为一个上午就能搞定, 但后来反反复复的弄了好久才ok.
前两天好不容易下载好desktop的iso镜像. 直接采用wubi安装. 到最后一步安装引导时出错. 导致无法进入系统.
后来找了张ubuntu5.04光盘重新进入 安装grub. 后来发现原来是双硬盘, hd0和hd1, 我把windows和ubuntu都安装在hd1的分区上, 而grub安装时是在hd0, 这样如果从hd0启动,就无法找到两个系统, 而如果是hd1启动, 又没有引导程序.
问题这样, 只能将另一硬盘卸掉再安装系统.
折腾了大半天, 终于安装好, grub1.97版也ok, 成功进入.
安装语言包, 设置源(http://www.ubuntuhome.com/ubuntu-9-10-yuan.html 取了里面的交大源, 速度算快了).
安装些其他软件
标签 <q></q> 用于引用文字, inline element, 适用于短小文本的引用;
标签 <blockquote></blockquote> 块引用, block element.
典型的inline元素: <q> <a> <em> <img>(这个有点特别,但确是行内元素)
block元素: h1, h2, ..., h6, p, blockquote, 块元素和行内元素的主要区别, 块元素之前之后都换行. Each block element is displayed on its own, as if it has a linebreak before and after it. Block elements separate content into blocks.
Remember: block elements stand on their own; inline elements go with the flow.
<br> <img>: empty element, 不包含任何内容; <br> does create a linebreak, but isn't typically displayed with space above and blow it like block elments are.
<ol>: orderlist; <ul>: unorderedlist; <li>: list item
<dl>: definition lists; <dt>: definition term; <dd>: description.
特殊字符 & 由&表示
"No matter where you go, there you are."
<code>
<address>
<strong>: to mark up text you want emphasized with extra strength. make a big point
<em>: use this element to mark up text you want emphasized. emphasizing.
<hr>: horizontal rules, like to start a new section without a heading.
<a id="chai"> some tee </a> <-- anchors, index#chai
images: JPEG和GIF
JPEG, for photos and complex graphics; 16万种颜色, 不支持透明, 有损压缩;
GIF, for images solid colors, logos and geometric shapes. 256种颜色, 无损压缩, 支持透明.
PNG, support both JPEG and GIF styles of image, width, height.
<img> is an inline element.
文档类型定义
HTML4.01的 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 还有strict.dtd
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 作为head的第一个子元素, 告诉浏览器此文档的content type, what kinds of characters are used to encode it.
meta元素都是告诉浏览器一些信息的, 这个meta是说, 该文档类型为text/html, 字符集是ISO-8859-1.
XHTML 1.0的<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML中每个元素都以/>结尾. html元素需要包含xmlns, lang, xml:lang属性.
<link type="text/css" rel="stylesheet" href="lounge.css" /> rel表示relationship between XHTML and the thing you're linking to.
serif(衬体): 印刷, 像这种字体, 有明显边角
sans-serif(无衬体): 屏幕, 边角圆滑,
/* comments in css */
"conflict" in css properity: If one rule is more specific than others, then it wins. If you can't reolve a conflict because two selectors are equally specific, you use the ordering of rules in your style sheet file. 如果对于class来说, order指在css中定义的class的顺序, 而不是元素中声明class值的顺序.
css validator: http://jigsaw.w3.org/css-validater/
关于字体的
font-family(顺序是先详细字体名, 后字体族), font-size, font-weight(lighter, normal, bold, bolder)
color关键词: Aqua, FuchSia, Lime, Olive, Red, Black, Gray, Maroon, Orange, Silver, Blue, Green, Navy, Purple, Teal,,,,
text-decoration(none, underline, overline, line-through, blink), 最后一个很少用.
font-family五种字体族
1) sans-serif: Verdana Arial, 可读性更好
2) serif: Time New Roman, 报纸上常用的字体
3) monospace: Curier Mono, 等宽字体, 常作代码
4) cursive: Comic Sans, 手写体
5) fantasy: Last MINIA, 装饰体, 4和5字体很多.
body {
font-family: Verdana, Geneva, Arial, sans-serif;
}
逗号分隔, 字体名区分大小写, 字体名若有空格的话,可以使用"xx xx" serif, sans-serif是字体族, 都有默认的哪种字体.
上面的body字体设置为: 大多数PC使用Verdana, Mac上Geneva, 都没有使用Arial(多种系统上都是常见的字体). 字体声明时最好是包括多种os平台上支持的字体.
font-size: 14px; 14像素表示字体的字符最高到最低共有14px. p确切告诉显示多大, 以像素单位. x%表相对大小, 为父元素*x的大小. em为相对大小, Scaling factor).
h2 {
font-size: 1.2em; /* 父元素的1.2倍 */
}
大小关键词: xx-small, x-small, small, medium, large, x-large, xx-large. 一般是20%的间隔大小, 12px的高度. 关键字定义大小对于每种浏览器的大小定义都是不同的.
如何选择?
1) 选择keyword(small or medium)指定为body的font-size;
2) 使用em/percentages 对于其他子元素. "慎用绝对, 妙用相对大小"
默认的body的font-size为16px 情况下, h1=200%*body, h2=150%*body, h3=120%*body, h4:100%, h5:90%, h6:60%
body设置为90%的话,表示body的默认大小的90%, 即16*90% = 14
font-style: italic,不是所有字体都支持斜体, 则可用oblique, 虽然也是斜体, 但两者有区别.
颜色名不区分大小写. rgb(80%, 40%, 0%) == rgb(204, 102, 0) == #CC6600 == #C60 80%*255 = 204
text-decoration: underline overline; /* 既有上线又有下线 */ 多值以空格分隔.
标签<del>表示删除的文本
标签<ins>表示插入的文本
Blink装饰, is a holdover from an old Netscape style.
background-position, sets the position of the image and can be specified in pixels or as a percentage, or by using keywords like top, left, right, bottom, and center.
background-repeat: no-repeat, repeat-x, repeat-y, inhreit(看父元素)
border-style: solid, double, groove, outset, dotted, dashed, inset, ridge.
style sheets的顺序是有关的, 从上到下, 下的优先.
<link type="text/css" rel="stylesheet" href="xxx.css" media="screen" /> media指定设备类型, 不指定media表示对所有设备. screen表示屏幕, print表示打印机, handheld表示小型设备. 之间顺序还是从上到下的优先级从小到大. 注意, 不是所有浏览器都支持media属性的
css盒模型控制元素的显示.
<p>中不能包含块元素.
Use, don't abuse, <div>s in your pages. Add additional structure where it helps you separate a page into logical sections for clarity and styling. Adding <div>s just for the sake of creating a lot of structure in your pages in complicates them with no real benifit.
<div> 只是结构.
text-align will align all inline content(for inline element) in a block element. this property should be set on block elements only.
#elixirs > h2: css中选择元素的直接后继使用">", 空格表示所有后继.
多个property合起来写
background: white url(image/cocktail.gif) repeat-x;
font: font-style font-variant font-weight font-size/line-height font-family;
<span> give you a way to logically separate inline content in the same way with divs allow you to create logical separation for block level content. just change the style of certain words.
对于inline元素的margin和padding, 和块元素表现有所不同. if you add a margin on all sided of an inline element, you'll only see space added to the left and right. you can add padding to the top and bottom of an inline element but the padding doesn't affact the spacing of the other inline elements around it, so the padding will overlap other inline elements. 但image和其他inline元素有所不同, 更像块元素.
伪类 a:link(未访问时) a:visited(访问之后) a:hover(鼠标移上去时) a:focus a:action(这两个已不被支持)
!important...
flow, 对于块元素, put a linebreak between each one. 从上到下依次显示, 每个元素间linebreak, 而inline元素, 水平上, 从左到右排列, 只要有空间就排列, inline在block元素内排列.
inline的margin的间距就是设置的space. 但对于block元素来说, 上下边距会合并起来, 去两者的大者. 嵌套元素的边距也可能被合并起来.
whenever you have two veritical margins touching, they will collapse, even if one element is nested inside the other.
Notice that if the outer element has a border, the margins will never touch, so they won't collapse. But if you remove the border, they will.
float, 从当前flow中删除该float元素, 其余块元素继续被填入, 但对于行内元素的边界为float元素所在之处. they flow around the borders of the floating element.
clear 元素, 用于清除当前flow, 如clear: right; 在该元素的左部不允许有floating的内容.
float只能是right和left, 没有center.
float元素边距不会重叠.
inline元素也可设置float, 常见的是img设置float.
liquid vs frozen
前者可缩放, 后者固定大小, 锁定.
"righty tighty, lefty loosey."
position为absolute时, top right, bootom left, 也从当前flow中移除, 独立开来; 有继承性, 其子元素看最近父元素的设置.
position默认为static, 即由flow来决定.
position为fixed时, is relative to the browser window rather than page, so fixed elements never move. 固定, IE6不支持fixed.
position为relative时, take an elemnet and flows it on the page just like normal, but then offsets it before displaying it on the page. 仍然是flow中.
position数值最好用%表示, 不要用px.
<table summary="xxx">
<caption>XXX</caption> 相当于表格的标题
...
border-spacing 边与边之间的距离
border-collapse: collapse
caption-side: bottom, 表格标题位置
td的rowspan="2"表示合并2行, 上一行设置rowspan, 下一行空出, 不需要
text-align, vertical-align, 设置表格中文字对齐方式.
colspan: 合并列
<tr>
<th></th>
<td></td>
</tr> <th>即可在每行中设置, 也可独立到某一行中.
list样式
list-style-type: disc(默认, 实心圆); circle(空心圆); square(实心方块); none(不显示)
list-style-image: url(images/back.gif);
order list样式
list-style-type: decimal(数字); upper-alpha; lower-alpha; upper-roman; lower-roman
list-style-position: inside(text wrap under the marker); outside(wrap under the text above it)
checkbox等多值标签可以命名为含[]的字符串形式.
GET请求限制为256个字符; POST没有限制.
form中标签
<fieldset>
<legend>xxx</legend>
<input />
</fieldset>
<label for="hot">hot</label> for后面是别的元素id
multiple="multiple" --> select的多选
1) 伪类 pseudo-classes, pseudo-elements,,,:first-letter, :first-line
2) 属性选择器,,,img[width], img[height="200"], img[alt~="flowers"] alt中包含flowers的
3) h1+p, "+"表示h1的兄弟p
4) frames, 切分网页
<frameset rows="30%, *, 20%">
<frame name="header" src="header.html" />
<frame name="content" src="content.html" />
<frame name="footer" src="footer.html" />
</frameset>
<a href="newpage.html" target="content">new content</a> 链接到content这个frame上
iframe: inline frame element. 允许你在一个网页中任意安放一个frame
<iframe name="inlinecontent" src="newcontent.html" width="400" height="200" />
使用frames需要设置特殊的DOCTYPE
HTML4.01 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
XHTML1.0 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xthml1/DTD/xhtml1-frameset.dtd">
5) <object> <embed> 多媒体标签
6) Emacs
7) js/client-side scripting
8) server-side scripting
9) meta的name和content
<meta name="description" content="一些描述" />
<meta name="keywords" content="关键词定义" />
<meta name="robots" content="noindex,nofollow" /> 告诉搜索引擎忽略此页
看完, 总结下来, 这书比较基础, 简单易懂, 但对于布局那边还不是很明白, 有空再好好看看.
= Native =
== Array ==
Array.each(fn[, bind]): 同$each
Array.every(fn[, bind]): 测试每个元素是否满足fn, 满足返回true. //dropwhile or takewhile
Array.filter(fn[, bind]): 过滤出满足条件的元素组成一个新的数组. //ifilter
Array.clean(): 创建一个新数组,其元素都为有效(非null和非undefined).
Array.indexOf(item[, from]): 返回元素在数组中的位置, 不存在时为-1. //index
Array.map(fn[, bind]): 创建一个新数组, 其元素为老数组中经过fn计算之后的值. //imap
Array.some(fn[, bind]): 只要有一个元素满足条件就返回true.
Array.associate(obj): 创建一个字典对象. 对象列表作为value, 参数列表作为key
Array.link(array, object): 根据类型创建一个字典. 这个有点意思, 看个例子:
...Here is some JavaScript code...
var el = document.createElement('div');
var arr2 = [100, 'Hello', {foo: 'bar'}, el, false];
arr2.link({myNumber: Number.type, myElement: Element.type, myObject: Object.type, myString: String.type, myBoolean: $defined});
//returns {myNumber: 100, myElement: el, myObject: {foo: 'bar'}, myString: 'Hello', myBoolean: false}
Array.contains(item[, from]): 测试数组是否包含item
Array.extend(array): 扩展一个数组 //chain or extend
Array.getLast(): 获得数组的最后一个元素
Array.getRandom(): 随机获得数组中的某个元素
Array.include(item): 将对象item添加到数组中(类型, 大小写敏感), 构成一个新数组
Array.combine(array): 合并数组(类型, 大小写敏感), 构成一个新数组
Array.erase(item): 将item从数组中删除.
Array.empty(): 清空数组.
Array.flatten(): 将多维数组转成一维数组.
Array.hexToRgb([array]): 将十六进制形式的颜色值转换成rgb形式. array为输出结构标志, 当为true时, 结果以数组形式输出(如[255, 51, 0]), 为false时, 以字符串形式输出(如: "rgb(255,51,0)").默认是字符串形式.
Array.rgbToHex([array]): rgb to hex. array含义同上.
...Here is some JavaScript code...
['11','22','33'].hexToRgb(); //returns "rgb(17,34,51)"
['11','22','33'].hexToRgb(true); //returns [17, 34, 51]
[17,34,51].rgbToHex(); //returns "#112233"
[17,34,51].rgbToHex(true); //returns ['11','22','33']
[17,34,51,0].rgbToHex(); //returns "transparent"
$A: 拷贝数组.
...Here is some JavaScript code...
function myFunction(){
$A(arguments).each(function(argument, index){
alert(argument);
});
};
myFunction("One", "Two", "Three");
== Function ==
Function.create()
...Here is some JavaScript code...
var myFunction = function(){
alert('hi');
};
var mySimpleFunction = myFunction.create(); //只是简单的拷贝;
var myAdvancedFunction = myFunction.create({//设置相关参数
arguments: [0, 1, 2, 3],//标准参数, event
attempt: true, //尝试执行返回的函数, 返回其值或错误.
delay: 1000,//延时
bind: myElemet, //函数this可以引用的对象
});
Function.pass()
...Here is some JavaScript code...
var myFunction = function(){
var result = "Passed: ";
for (var i = 0, l = arguments.length; i < l; i++){
result += (arguments[i] + ' ');
}
return result;
}
var myHello = myFunction.pass('hello');
var myItems = myFunction.pass(['peach', 'apple', 'orange']);
alert(myHello()); // 'hello'
alert(myItmes()); // 'peach' 'apple' 'orange'
Function.attempt()
尝试执行函数
myFunction.attempt([args[, bind]]);
...Here is some JavaScript code...
var myObject = {
'cow': 'moo!'
};
var myFunction = function(){
for (var i = 0; i < arguments.legnth; i++){
if (!this[arguments[i]]) throw('doh!');
}
};
var result = myFunction.attempt(['pig', 'cow'], myObject); // result = null
Function.bind()
改变目标函数的this范围, 为bind.
myFunction.bind([bind[, args[, evt]]]);
...Here is some JavaScript code...
function myFunction(){
//刚开始this指向windows, 而不是一个元素
this.setStyle("color", "red");
};
var myBoundFunction = myFunction.bind(myElement);
myBoundFunction(); // this为myElement, 让myElement文本颜色为红色
Function.bindWithEvent()
myFunction.bindWithEvent([bind[, args[, evt]]]);
...Here is some JavaScript code...
var Logger = new Class({
log: function(){
console.log.apply(null, arguments);
}
});
var Log = new Logger();
$("myElement").addEvent("click", function(event, offset){
offset += event.client.x;
this.log("clicked; moving to:", offset); // this 指向myClass
event.target.setStyle("top", offset);
return false;
}.bindWithEvent(Log, 100));
Function.delay()
等待执行某函数
...Here is some JavaScript code...
var timeoutID = myFunction.delay(delay[, bind[, args]]);
(function(){alert("one second later...");}).delay(1000);
var myFunction = function(){ alert("hi"+this.id); };
myFunction.delay(50, myElement);
Function.periodical()
周期执行某函数
...Here is some JavaScript code...
var Site = { counter: 0 };
var addCount = function(){ this.counter++; };
addCount.periodical(1000, Site);
Function.run()
执行函数
myFunction.run(args[, bind]);
...Here is some JavaScript code...
var myFn = function(a, b, c){
return a+b+c;
}
var myArgs = [1,2,3];
myFn.run(myArgs); // return 6
var myFn2 = function(a, b, c){
return a+b+c+this;
}
var myArgs = [1,2,3];
myFn2.run(myArgs, 6); // return 12
== Number ==
Number对象
myNumber.limit(min, max); 返回与min和max中的值
myNumber.round([precision]);
...Here is some JavaScript code...
(12.45).round() // 12
(12.45).round(1) // 12.5
(12.45).round(-1) // 10 即在各位上取整
myNumber.times(fn[, bind]);
...Here is some JavaScript code...
(4).times(alert); // alerts 0, 1, 2, 3
myNumber.toFloat();
Strings和Numbers都可用这个函数将其转换成浮点数
...Here is some JavaScript code...
(111.1).toFloat(); //return 111.1
myNumber.toInt([base]);
按照base进制转换成整数
...Here is some JavaScript code...
(111).toInt(2); // return 7
== String ==
myString.test(regex[, params]);//正则式匹配
myString.contains(string[, separator]);
后面的separator为分隔符, 默认为''
...Here is some JavaScript code...
alert('a bc'.contains('b')); //true
alert('a bc'.contains('b', ' ')); //false
myString.trim(); //去除前导, 尾处空格
myString.clean(); //删除所有多余的空格. 多个连续空格变成一个空格
...Here is some JavaScript code...
" i like cookies \n\n".clean(); //returns "i like cookies"
myString.camelCase(); // 格式化字符串, 以首字符大写形式, 和下面的hyphenate()作用正好相反.
...Here is some JavaScript code...
"I-like-cookies".camelCase(); // returns "ILikeCookies"
myString.hyphenate();
...Here is some JavaScript code...
"ILikeCookies".hyphenate(); // returns "I-like-cookies"
myString.capitalize();//大写
myString.escapeRegExp(); //转义所有正则式中的特殊字符, 如. 转换为\.
myString.toInt([base]);//以base进制转换成一整型, 返回number, 或NaN
myString.toFloat(); // float or NaN
...Here is some JavaScript code...
"4em".toInt(); // returns 4
"10px".toInt(); // returns 10
"95.335%".toFloat(); // returns 95.335
myString.hexToRgb([array]);//将十六进制形式的颜色转成RGB形式, array为布尔型, true时返回的结果以数组形式而不是字符串的"rgb(0,0,0)"
myString.rgbToHex([array]); //RGB转成十六进制..."rgb(255,255,255)", or "rgba(255,255,255,1)"
...Here is some JavaScript code...
"#123".hexToRgb(); // "rgb(17, 34, 51)"
"112233".hexToRgb(); // "rgb(17, 34, 51)"
"#112233".hexToRgb(true); // [17, 34, 51]
"rgb(17,34,51)".rgbToHex(); //returns "#112233"
"rgb(17,34,51)".rgbToHex(true); //returns ['11','22','33']
"rgba(17,34,51,0)".rgbToHex(); //returns "transparent"
myString.stripScripts([evaluate]);//过滤script标签
evaluate为true时, 字符串中包含的脚本会被执行.
myString.substitute(object[, regexp]); // 对象形式提供值以替换字符串中的变量. regexp默认为/\?{([^}]+)}/g
...Here is some JavaScript code...
var myString = "{a} is {b}";
var myObject = {a:'aa', b:'aa'};
myString.substitute(myObject); // aa is aa
== Hash ==
自定义对象Object不能使用Object.prototype. 但Hash可以使用prototype.
...Here is some JavaScript code...
var myHash = new Hash([object]);
myHash.each(fn[, bind]);
fn(value, key, hash)
...Here is some JavaScript code...
var hash = new Hash({first: "Sunday", second: "Monday"});
hash.each(function(value, key){
alert("the "+key+" day of the week is "+value);
});
myHash.has(item); //测试是否包含指定key
myHash.keyOf(item); //和Array:indexOf()类似. 返回item的key值, 不存在的话返回false
myHash.hasValue(value); //是否包含某个值
myHash.extend(properties); // 扩展键值对
myHash.combine(properties); //联合, 里面不允许重复(旧值不能被覆盖), 大小写和类型敏感.
myHash.erase(key); //去除某个key. 返回去除之后的hash
myHash.get(key); // 获得key对应的值, 不存在时返回null
myHash.set(key, value); // 插入/修改key的值为value
myHash.empty(); //清空hash对象
myHash.include(key, value); // 如果key不存在, 则将key-value插进去. 存在key的话, 不做修改
myHash.map(fn[, bind]); // 创建一个新的map, 其对应值是对于hash中每个值计算fn之后的值.
...Here is some JavaScript code...
var timesTwo = new Hash({a:1, b:2, c:3}).map(function(value, key){
return value*2;
}); // timesTwo为{a: 2, b:4, c:6};
myHash.filter(fn[, bind]); //过滤fn返回true的元素.
myHash.every(fn[, bind]); // 测试hash中每个值是否满足fn, 都满足返回true, 否则false.
myHash.some(fn[, bind]); // 至少一个值满足fn, 返回true, 都不满足返回false
myHash.getClean(); // 返回一个"干净"的对象, 即不包括任何键值对.
myHash.getKeys(); // 返回所有key的数组.
myHash.getValues(); // 返回所有value的数组, 和上面的key相同顺序.
myHash.getLenght(); // 返回Hash的长度, 即key的个数.
myHash.toQueryString(); // 返回URI中的查询字符串.
...Here is some JavaScript code...
Hash.toQueryString({apple: "red", lemon: "yellow"}); //returns "apple=red&lemon=yellow"
$H // 用于创建Hash的快捷方法.
== Event ==
new Event([event[, win]]); // event指HTML事件对象, win表示windows, 表示事件的上下文.
它有很多的属性.
...Here is some Text code...
* shift - (boolean) True if the user pressed the shift key.
* control - (boolean) True if the user pressed the control key.
* alt - (boolean) True if the user pressed the alt key.
* meta - (boolean) True if the user pressed the meta key.
* wheel - (number) The amount of third button scrolling.
* code - (number) The keycode of the key pressed.
* page.x - (number) The x position of the mouse, relative to the full window.
* page.y - (number) The y position of the mouse, relative to the full window.
* client.x - (number) The x position of the mouse, relative to the viewport.
* client.y - (number) The y position of the mouse, relative to the viewport.
* key - (string) The key pressed as a lowercase string. key can be 'enter', 'up', 'down', 'left', 'right', 'space', 'backspace', 'delete', and 'esc'.
* target - (element) The event target, not extended with $ for performance reasons.
* relatedTarget - (element) The event related target, NOT extended with $.
...Here is some JavaScript code...
$("myLink").addEvent("keydown", function(event){ //传递过来的event已经是一个event对象
alert(event.key); //按键字符的小写.
alert(event.shift); //如果按了shift键就为true.
if (event.key == 's' && event.control) alert("Document saved.") // 这很方便获取键盘的ctrl+s哪~~
});
myEvent.stop(); // 停止事件, 并执行preventDefault.
...Here is some JavaScript code...
// <a id="myAnchor" href="http://google.com/">Visit Google.com</a>
$("myAnchor").addEvent("click", function(event){
event.stop(); // 阻止浏览器
this.set("text", "Where do you think you're going?"); // "this" 是触发该事件的元素.
(function(){
this.set("text", "blog").set("href", "http://blog.mootools.net");
}).delay(500, this); //500后设置新的链接
});
myEvent.stopPropagation(); //停止"传播", 子元素触发的事件后, 阻止父子元素触发事件.
...Here is some JavaScript code...
//<div id="myElement">
// <div id="myChild"></div>
//</div>
$("myElement").addEvent("click", function(){
alert("click");
return false; // 等价于stopPropagation.
});
$("myChild").addEvent("click", function(event){
event.stopPropagation(); // stop之后, 就不会触发父元素的点击事件.
});
myEvent.preventDefault(); // 阻止事件的默认操作
...Here is some JavaScript code...
//<form>
// <input id="myCheckbox" type="checkbox" />
//</form>
$("myCheckbox").addEvent("click", function(event){
event.preventDefault(); // myCheckbox不会是选中状态.
});
Event.Keys // 可以增加额外的事件key代码
...Here is some JavaScript code...
Event.Keys.shift = 16; // 没明白这句...
$("myInput").addEvent("keydown", function(event){
if (event.key == "shift") alert("pressed shift");
});
Mootools文档: http://mootools.net/docs
第一部分是核心函数.
= Core =
== $chk(item); ==
检查对象是否存在或者是否为0, 是的话返回true, 否则为false.
== $clear(timer); ==
清除一定时器或定时间隔, 和Function:delay, Function:periodical配合使用.
timer为setInterval(periodical)和setTimeout(delay)的标识符. 返回为null.
...Here is some JavaScript code...
var myTimer = myFunction.delay(5000); //delay and periodical
myTimer = $clear(myTimer);
== $defined(obj); ==
检测obj的值是否被定义.不为null和undefined时返回true, 否则返回false.
== $arguments(i) ==
返回一个函数的第index个参数.
...Here is some JavaScript code...
var secondArgument = $arguments(1);
alert(secondArgument('a', 'b', 'c')); // Alerts "b"
== $empty ==
占位函数, 通常用作事件处理函数.
...Here is some JavaScript code...
var myFunc = $empty;
== $lambda(sth); ==
返回一函数用于直接返回传入的值(其他什么都不做).
...Here is some JavaScript code...
myLink.addEvent('click', $lambda(false)); 阻止click事件.
== $extend(original, extension); ==
拷贝第二个对象的所有属性给第一个对象.
...Here is some JavaScript code...
var firstObj = {
'name': 'John',
'lastName': 'Doe'
};
var secondObj = {
'age': '20',
'sex': 'male',
'lastName': 'Dorian'
};
$extend(firstObj, secondObj);
//firstObj is now: {'name': 'John', 'lastName': 'Dorian', 'age': '20', 'sex': 'male'};
== $merge(); ==
(递归)合并多个对象.
...Here is some JavaScript code...
var nestedObj1 = {a: {b: 1, c: 1}};
var nestedObj2 = {a: {b: 2}};
var nested = $merge(nestedObj1, nestedObj2); // {a: {b: 2, c: 1}} 其中的值是根据什么规则来计算的??
== $each(iterable, fn[, bind]); ==
对于每个iterable中的元素执行fn, fn包含当前对象, 当前对象的位置, 和总对象.
fn(item, index, object)
...Here is some JavaScript code...
//Alerts "The first day of the week is Sunday", "The second day of the week is Monday", etc:
$each({first: "Sunday", second: "Monday", third: "Tuesday"}, function(value, key){
alert("The " + key + " day of the week is " + value);
});
== $pick ==
返回第一个有效定义(不为null)的值.
...Here is some JavaScript code...
var picked = $pick(var1[, var2[, ...]]);
== $random(min, max); ==
随机返回min和max中的一个值. 闭区间.
...Here is some JavaScript code...
alert($random(5, 20));
== $splat(obj); ==
将obj转换成数组.
...Here is some JavaScript code...
$splat('hello'); //Returns ['hello'].
$splat(['a', 'b', 'c']); //Returns ['a', 'b', 'c']. 汗...这个有何意义?
== $time(); ==
返回当前时间.
== $try(fn[, fn, fn, fn, ...]); ==
尝试执行多个fn, 返回的值为第一个正确执行的函数返回值.
== $type(obj); ==
一字符串形式返回obj的类型
= Browser =
获得浏览器的相关信息, 使用引擎版本, 平台等.
虽说凤凰岛研究生期间去了起码3,4次了,但今天这趟是玩的最最开心的了。
早早过去乘车过去,到那已经是九点半了,貌似郊外的空气特别的好。
之后整理下东西,租了些工具,开始烧烤。。。买的肉类非常多,我们都没空拷蔬菜(后来一大袋全都浪费掉了),羊肉串(我最不喜欢的个),鸡肉串(刚开始都是生的:P),烤肠,虾(还不错),鲜贝(也很不错,就是腥了点),鳕鱼(几乎都是我吃的),鱿鱼串(烤了半天才烤熟,后来都没人吃),鸡翅(这个貌似是拷的最成功的,看上去很诱人)。。。吃的撑死了~估计每个人肚子都杂七杂八的填了一大堆东西,包括其他各种各样的零食。
(某位师妹说烤香蕉非常好吃,可我们尝试了很多次都没有成功,味道几乎和生香蕉的一样,就是热了点)
烧烤结束,散散步,到了邵伯湖边的一个休息大厅里,我们这帮子人玩杀人游戏,可怜的我警察都没有做到,当了好几次杀手(ps,都是一个显而易见的杀手,早早就被别人猜出了)。
(杀人游戏中)
坐在湖边,风很大,吹的我们有些凉,于是决定百度到对面的湿地岛上转圈看。里面有个索桥,去的时候,前面有个别的学校的女生不小心把手机掉在河里面了,那女生急得快哭起来了。后来好不容易找了工作人员来帮忙找,但貌似也没办法了,因为都掉到河底了,底下都是淤泥,不怎么好找。。。所以以后得小心点随手的东西,比如手机,相机什么的东西。
(邵伯湖边上一行)
然后看到一个荒废的咖啡吧木屋,非常有个性的个。想想以后在这种类似的地方有一间这样的木屋,楼下开店,楼上居住,也很不错撒,远远的芦苇荡,长长的木质小道,前面小河缓缓流淌,后面花园种各种各样的花。。。真的很不错~~~
(通向咖啡吧。)
(咖啡吧对面的湿地)
回来途中,经过游乐园时,玩了些稍有刺激的项目,里面的海盗船,非常刺激,喊得我们嗓子都快哑了。。。ps,那老板说买一个送一个,估计玩了一次,另外一次就算是送的也不想玩了。
夜色将近,天气很冷。离开美丽的凤凰岛。回到市里的灯红酒绿。
(夕阳西下,断肠人在天涯)
累也累也,早点休息~
随后加上些很有意思的照片:)
又是一个周末到来。
人还真的奇怪,忙的时候总感觉时间过得好快,真想好好休息休息,想再也这么拼死拼活的忙来忙去了;但现在闲下来,又觉得时间无比漫长~
日复一日的这样过。貌似没啥期待和惊喜,能够让自己精神起来~~~
最近网络慢得不行,真的快比时间还慢了。这就更让我无所事事了。幸好手头有两本书看看,不至于真的无所事事。
另外,也帮帮师妹师弟解决些问题。其实,老实说,我也不是很懂,就像今天师妹问我一个问题。是他导师布置给她的一个小任务(再ps下,现在发现有老师指导和没有老师指导真的存在差别,导师会给他一个学习的方向,而自己学只会瞎“玩”),是将axis部署到tomcat中。axis是apache下用于web service开发的开源应用,照文档上说的做,但结果测试出来总是找不到某个jar文件,一些path都已经设置了,并且明明lib下有相关的jar包。但仍然不对。搞了半天,小郁闷。后来直接将axis提供的war丢到webapps下,就ok了。看来,看来我对java实在是不敏感哪~~~
第二个任务是,安装postgresql,这个也很诡异,师妹在windows上安装postgresql8.x的,安装时总弹出fetal error的错误,查看日志未果,后来怀疑是不是安装位置的文件系统是NTFS原因,于是换成另外一个,但诡异的时,选择了其他路径之后,安装过程时的目录仍然是旧目录。。。。汗一个,而我在ubuntu下安装同样过程是没有任何问题。
怪也怪也。。。
再再ps下,明天实验室组织去凤凰岛烧烤,可以呼吸下郊外的新鲜空气了:P
加油,加油!!