Please send any feedback on admin@ajaxline.com.
If you want to share your experience and post article on Ajaxline just e-mail it to us and we publish it.
Rob Gravell post an intresting tutorial about using JSON format in JavaScript. He writes:
«JavaScript Object Notation, or JSON for short, is a lightweight data-interchange format which may prove to be a viable alternative to XML for IT developers. The purpose of a data-interchange format is to transfer information between potentially incompatible technologies. For example, the sender may be a Java application running on Unix and the receiver could be a Visual Basic program running on Windows. In this instance one would require a standardized format to send the data because the applications could not communicate directly with each other. Even if they could, using a protocol such as TCP/IP or FTP, the data structures would have be to be defined somewhere. That's where the data-interchange format comes in. When XML came onto the scene in the late nineties, it was hailed as a godsend by many business managers because it was intuitive to look at and based on the well-known HTML language. Developers, on the other hand, were less impressed. It turns out that parsing XML was not nearly as simple as one might think! Today, despite the proliferation of programming libraries to perform many common tasks, from extracting node attributes to searching for specific data in the hierarchy, programmers are still faced with a learning curve when having to deal with the tags. Web developers faced a similar situation in the early days of dynamic HTML content. Eventually, frameworks such as Struts and Spring provided a way to handle "boiler plate" tag generation. Now, JSON offers developers a more familiar means of structuring data. »
Source: WebReference.com.
Walking on JavaScript objects trees. Can we do it with JSON or JavaScript like we can while we work with XML?
Lazy Inheritance is an approach intended to simplify writing OOP and provides support of prototype-based classes hierarhies, automatic resolving and optimizing classes dependencies.
JSINER (originated from JavaScript INheritance supportER) is a lazy inheritance implementation in JavaScript. JSINER page on SoftAMIS
Today I want to share my project. Implementation of Panels like was in My Yahoo page. Now this page updated to new look.
To create Layout like this:
Here is example: www.ajaxline.com/JS/Panels/PanelsTest.htm
Today I want to share my javascript Context Menu control built with prototype.js.
It's pretty simple to use it :
In the head section of page add such code:
<link href="style/style.css" rel="stylesheet" type="text/css" />
<script type ="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/domutils.js"></script>
<script type="text/javascript" src="js/menu.js"></script>
<script type="text/javascript">
window.onload=function(){
var items = [
{ text: "Choose address", onclick:function(){alert("item0");} },
{ type: "divider"},
{ text: "Copy", onclick:function(){alert("item1");} }
];
var menu =new ContextMenu("table_body",items);
// menu.onBeforeShow =function(menu){ alert("on before show");};
// menu.onClose = function(menu){alert("on close");}
}
</script>
Where:
NB. I???"?ve amended the code samples below to reflect recent changes in this class.
I???"?m an OO programmer at heart and JavaScript supports prototype based inheritance. Unfortunatley this leads to verbose class definitions:
function Animal(name) {};
Animal.prototype.eat = function() {};
Animal.prototype.say = function(message) {};
I want a nice base class for JavaScript OO:
Widgets walk a fine line between abstractions and implementations. Implementation, in this case, is a practical solution chosen to perform a given function. The problems with widgets occur when the widget author walks too far in one direction, or worse, walks an outward spiral covering both directions. Both choices lead to script bloat and complexity thats hard to manage. You no longer have a simple solution for a defined problem, you have a complex solution for a variety of problems. The good news is there are ways to avoid both the bloat and complexity.