UFOV页面 使用canvas

canvas画八边形:cxt.beginPath();cxt.beginPath();

canvas内线条的粗细:cxt.lineWidth = '2';

鼠标消失:

css:

html, body {
height: 100%;
width: 100%;
}

js:$('body').css({cursor: 'none'});

问题1

if(2 < 1 < 5) {

 ...

}

2 < 1 < 5 : 2 < 1 = false = 0, 0 < 5 = true

问题2:需要记录很多变量,大多数的操作刚开始都是一样的,一个个写太丑了,所以想把字符串存入数组,需要的时候再变过来。这样页面比较简洁。

把字符串转为变量

var abc='b';
var b=5;
console.log(abc);
console.log(eval(abc));
console.log(window["abc"]);
console.log(window[abc]);    //window['b']

 在jquery中,需要:

$(document).ready(function(){
    var abc='b';
    this.b=5;     //本范围的变量
    console.log(this[abc]);
});

  因为this会变,所以还是使用temp object scope要好一些!stackoverflow真是太有用了!

问题3

$($('div')[0]):太丑了,不知道有没有好的写法,除了分开写。

问题4:cm转为px

 

 

posted on 2014-10-02 16:11  j.w  阅读(248)  评论(0编辑  收藏  举报