js tip note
1
| setTimeout("history.go(-1)",3000); //注意必须在执行的方法内加引号,否则会马上执行 |
1
2
3
4
5
6
| var str="Hello world!";
document.write(str.substr(3,7)); //lo world!
var str="Hello world!";
document.write(str.substr(3)); //lo worl
//substr() 方法可在字符串中抽取从 start 下标开始的指定数目的字符。 |
1
2
| var str="Visit Microsoft!"
document.write(str.replace(/Microsoft/, "W3School")) |
1
| $("#jie option:contains('" + jie + "')").prop("selected", true); |
1
2
3
4
5
| $(window).scroll(function () {
if ($(document).scrollTop() + $(window).height() >= $(document).height()) {
alert("哦哦,到底了.");
}
}); |
1
| <body oncontextmenu=self.event.returnValue=false onselectstart="return false"> |
1
| <body oncontextmenu=self.event.returnValue=false onselectstart="return false"> |