???????????20?????? ??????????
???????????? ???????[ 2012/12/17 10:05:54 ] ????????
????3????for...Loops?????hasOwnProperty()????
????JavaScript????????й????????????????????????????????????????????
1.for (var prop in someObject) {
2. alert(someObject[prop]); // alert's value of property
3.}
????????????????????for...in loop?????????????????????????????????????????????????????е??????????????????????????????????????hasOwnProperty()?????????????£?
1.for (var prop in someObject) {
2. if (someObject.hasOwnProperty(prop)) {
3. alert(someObject[prop]); // alert's value of property
4. }
5.}
????4?????????
????????????????????б????????????????????????????????????????
1.if (foo == true) {
2. // do something for true
3.} else {
4. // do something for false
5.}
???????foo==true???????????????????foo????????????????????д?У?
1.if (foo) {
2. // do something for true
3.} else {
4. // do something for false
5.}
?????????????д??
1.if (!foo) {
2. // do something if foo is false
3.} else {
4. // do something if foo is true
5.}
????5???????
??????JavaScript?У???????????????????e???event bubbling???????????????????????inline onclick?????????Щ?????“????”??????
??????????????????????????????modal lightbox?????????????????????????????????jQuery?????????????????????????e????????????????JavaScript??
????????HTML????
1.<div id="grid-container">
2. <a href="someimage.jpg"><img src="someimage-thumb.jpg"></a>
3. <a href="someimage.jpg"><img src="someimage-thumb.jpg"></a>
4. <a href="someimage.jpg"><img src="someimage-thumb.jpg"></a>
5. ...
6.</div>
?????????JavaScriptд????
1.$('a').on('click'?? function() {
2. callLightbox(this);
3.});
??????δ?????????lightbox?????洫?????anchor?????????????????????????anchor??????????????#grid-container????
1.$("#grid-container").on("click"?? "a"?? function(event) {
2. callLightbox(event.target);
3.});
????????δ????У?this??event.target?????anchor?????????????????κθ????????á?????????????????????????У?event's target????
????6?????????????
??????JavaScript??PHP?У?????????????????????????飺
1.// javascript
2.return foo.toString() !== "" ? true : false;
1.// php
2.return (something()) ? true : false;
?????????ж????????????false??true??????????????????true??false???????????????С??????????????????????
1.// javascript
2.return foo.toString() !== "";
1.// php
2.return something();
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11