2014-11-20 Create JSON Object in JavaScript 12345678910111213var json = {};var singleObj = [];var obj = new Object; //Remember to declare an object so you can add key to itobj.key1 = "value1";obj.key2 = "value2";singleObj.push(obj);json["singleObj"] = singleObj;var jsonString = JSON.stringify(json); //Change JSON Object to Stringwindow.console.log(jsonString); //{"singleObj":[{"key1":"value1","key2":"value2"}]}
2014-11-18 Print Out Iframe using Javascript You can print out a page by putting it to an iframe, then print out it: \ 123456789//Create iframe element (skip this if you already had one)var iframe = document.createElement("iframe");iframe.src = "Link_To_Your_Page";iframe.id = "printOut";iframe.style = "display:hidden"; //You can skip this if you want to show iframe on your pagedocument.body.appendChile("iframe");document.getElementById("printOut").focus();document.getElementById("printOut"),contentWindow.print(); //print out iframe