XML DOM Parsing in Javascript

XML parser reads XML, and converts it into an XML DOM object that can be accessed with JavaScript. Example : Javascript Snippet var str_inputxml = “<root><row id=’1′>One</row><row id=’2′>Two</row></root>”; var obj_parser=new DOMParser; var obj_xml = obj_parser.parseFromString(str_inputxml, “text/xml”); var obj_rows=obj_xml.selectNodes(“/root/row”); var text; //Select Text Node if(obj_rows.length>0) { text = obj_rows.item(0).text; } //Select Attribute Value var attributes = […]

String Replace All – Javascript

In general JavaScript replace function replaces the first occurrence in the string. It takes two parameters , first parameter to find the string and second parameter is string to replace when it found. Replace Snippet : var str = “Javascript find Function”; str = str.replace(“find”,”replace”); Replace All Snippet : var str = “Javascript find Function”; […]

CSS Reset

CSS Reset removes the inconsistent styling for HTML element in the browsers . YUI CSS Reset To use css reset include source file in your web page <link rel=”stylesheet” type=”text/css” href=”http://yui.yahooapis.com/3.2.0/build/cssreset/reset-min.css”> An Example http://developer.yahoo.com/yui/3/examples/cssreset/cssreset-basic_source.html

Scroll to top