본문 바로가기

Web/Javascript

timer class http://www.dailycoding.com/posts/object_oriented_programming_with_javascript__timer_class.aspx 더보기
js minifier https://javascript-minifier.com/ http://jscompress.com/ 더보기
inheritance [code] // 부모 var Parent = function() { this.name = 'Parent'; this.func = function() { alert(this.name); }; } // 자식 var Child = function() { this.name = 'Child'; this.func = function() { alert(this.name); }; } Child.prototype = new Parent(); window.onload = function() { var oChild = new Child(); oChild.func(); } [/code] 더보기
string to json javascript 에서 string 을 json 으로 변경 시키는 방법은 다음과 같다. [code] var otherString = '{"aspect": "' + key + '", "property": "' + statusList[key][key2] + '"}'; var jsonData = eval('(' + otherString + ')'); [/code] 예) [code]var statusList = { "Battery" : ["batteryLevel", "batteryBeingCharged"], "Device" : ["imei", "model", "version", "vendor"], "Display" : ["resolutionHeight", "pixelAspectRatio", "dpiY", "r.. 더보기
queue [code] input show list show detail list remove [/code] 더보기
remove array http://wolfram.kriesing.de/blog/index.php/2008/javascript-remove-element-from-array [code] Useful DO Actually, what I mostly need is: remove a certain value from an array. I.e. I have some list of visible IDs and I want to remove one because it’s not visible anymore. So just extend the above example a bit. >>> var visibleIds = [4,5,6]; >>> var idx = visibleIds.indexOf(5); // Find the index >>> i.. 더보기
callback [code] function checkFuncType(func) { if (func == null || typeof func != "function") { return false; } return true; } function checkSuccessCallbackFunc(successCallback, errorCallback) { var success = checkFuncType(successCallback); var error = checkFuncType(errorCallback); if (!success || !error) { if (error) { errorCallback("error callback"); return false; } else { throw "throw error"; } } succ.. 더보기
addEventListener window.onload = function() { document.getElementById("nabiTitle").innerText = "Hello Nabi"; with(document.getElementById("gingerbread")) { innerText = "Download file(Gingerbread)"; addEventListener("click", function() { location.href="./gingerbread.tar.bz"; }, false); } } 더보기
foreach http://mwultong.blogspot.com/2008/01/foreach-javascript-foreach.html 더보기
definition http://www.yourhtmlsource.com/javascript/basicjavascript.html external scripts [code][/code] simple scripts [code] [/code] 더보기