Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts
Wednesday, February 22, 2012
Tuesday, January 24, 2012
Friday, November 11, 2011
Friday, April 15, 2011
Wednesday, April 13, 2011
Sunday, April 10, 2011
Tuesday, January 18, 2011
Understanding node.js
http://debuggable.com/posts/understanding-node-js:4bd98440-45e4-4a9a-8ef7-0f7ecbdd56cb
Saturday, January 15, 2011
Thursday, January 14, 2010
Javascript email Regex
var email = "^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$";
Tuesday, November 24, 2009
What does document.domain = document.domain do?
http://stackoverflow.com/questions/1481251/what-does-document-domain-document-domain-do
I encounter a domain problem today and finally get it work by
document.domain = document.domain
Also, if you press the back button, the onload event of iframe will be faster than that of the parent frame and may cause permission denied error. The solution to this is to setTimeout and use the try-catch loop.
I encounter a domain problem today and finally get it work by
document.domain = document.domain
Also, if you press the back button, the onload event of iframe will be faster than that of the parent frame and may cause permission denied error. The solution to this is to setTimeout and use the try-catch loop.
Wednesday, October 21, 2009
Check whether children elements exceed the overflow parent
<div id="f" style="overflow: hidden; background-color: red; width: 300px; height: 300px;">
<div id="s" style="background-color: green; width: 350px; height: 300px;">
</div>
<script><br />if (f.scrollWidth > f.clientWidth){<br />alert("overflowed");<br />}<br /></script></div>
<div id="s" style="background-color: green; width: 350px; height: 300px;">
</div>
<script><br />if (f.scrollWidth > f.clientWidth){<br />alert("overflowed");<br />}<br /></script></div>
Monday, October 19, 2009
Tuesday, October 13, 2009
Friday, October 9, 2009
Sunday, September 27, 2009
Sunday, September 20, 2009
Speed up your javascript Tutorial
Speed up your javascript:
http://www.youtube.com/watch?v=mHtdZgou0qU&feature=channel_page
Great Tutorial!
http://www.youtube.com/watch?v=mHtdZgou0qU&feature=channel_page
Great Tutorial!
Sunday, August 30, 2009
Sort JSON by its key(properites)
Today, I need to sort the JSON by its key(properties) and I write the following extended function to array element.
Array.prototype.extendSort = function(field,desc){
function sortField(a,b){
if (a[field] == b[field]){
return 0;
}
var result = a[field] > b[field]?1:-1;
if (desc == true) result=result*-1;
return result;
}
this.sort(sortField);
}
var testjson = [{"id":3, "name":"Charlie"},{"id":5, "name":"Danny"},{"id":4, "name":"Billy"}]
testjson.extendSort("id", false);
PS:
If you want to loop through the array using for...in statement, you may find that the extendSort also recognizes as one of the object.
You should use the following code to deal with that:
for (name in testjson) {
if (testjsonj.hasOwnProperty(name)) {
...
}
}
Array.prototype.extendSort = function(field,desc){
function sortField(a,b){
if (a[field] == b[field]){
return 0;
}
var result = a[field] > b[field]?1:-1;
if (desc == true) result=result*-1;
return result;
}
this.sort(sortField);
}
var testjson = [{"id":3, "name":"Charlie"},{"id":5, "name":"Danny"},{"id":4, "name":"Billy"}]
testjson.extendSort("id", false);
PS:
If you want to loop through the array using for...in statement, you may find that the extendSort also recognizes as one of the object.
You should use the following code to deal with that:
for (name in testjson) {
if (testjsonj.hasOwnProperty(name)) {
...
}
}
Friday, August 28, 2009
XSS (Cross Site Scripting) Cheat Sheet
http://ha.ckers.org/xss.html
http://amix.dk/blog/viewEntry/19432
http://amix.dk/blog/viewEntry/19432
Subscribe to:
Posts (Atom)