Skip to main content

Posts

Showing posts from January, 2009

Using javascript to Include a html file inside another html file

When there is no server side functionality needed we create the whole site in plain html. Usually these sites have left/right side menu, top header, footer etc.. If the site grows in to 20, 30 pages, it will be a headache to do a simple change like changing footer text. We will have to change each page. If we were using a server side technology like PHP, JSP, etc.., we will have the chance to keep the common areas in the site in different pages and include these parts in each page using a “include” statements. We can do the same thing with the plain old html and javascript. But how? First you need to create the site main layout using divs and give them unique ids. <html> <title>HTML Includes</title> <script language="javascript" src="js/main.js"></script> <script src="js/prototype.js" type="text/javascript"></script> <script language="javascript" xml:space="preserve"> // <

Useful method to find the next list node in an unordered list from javascript

If we try to use object.nextSibling to get the next list object of an unordered list, it is not always returning a list object. The following method can be use to get the next list object of an unordered list. function getNextLi(the_li) { var next_li = false; if (the_li.nextSibling != null && the_li.nextSibling.nodeName == "LI") next_li = the_li.nextSibling; return next_li; }

WSO2 is giving control back to software architects and developers to build and manage an SOA

SOA is a popular approach to enterprise architecture because it can improve IT flexibility, allowing a business to quickly adapt to changes. However, many specifications and implementations of "SOA solutions" are available making it somewhat difficult to figure what you really need (and what you don't) to build and manage an SOA. WSO2 is giving control back to software architects and developers, with a unified SOA middleware platform that allows you to seamlessly add product capabilities as your implementation grows. This modular platform is WSO2 Carbon. The design of WSO2 Carbon focuses on separating key functionality of the SOA platform into separate components that can be mixed and matched, like customizable building blocks. http://wso2.org/projects/carbon

Essential steps for cross browser compatible Javascript

Working with javascript opens up a whole set of possibilities for web developers. But at the same time, web developers have to deal with bunch of new issues when dealing with several browsers. The main reason behind this is because, each vendor has implemented the DOM in each browser differently. Some follows W3C standard while others don't. MS IE is the big bully in the block. IE usually doesn't respect W3C standards. So developers must put little extra effort from the very beginning of there development. Always use a cross browser compatible javascript library for your DOM methods. - YUI ( http://developer.yahoo.com/yui/event/ ) - JQuery ( http://jquery.com/ ) Separate the view of the application (HTML) from its behavior (JavaScript). Always be extra careful when dealing with dynamic event handlers. Ex: (YUI is used in the following example and it outlines a practice example of the above three) The html file (test.html) <html> <head>