Milinda Pathirage’s Blog

Let the code talk for yourself!

Entries Tagged as 'JavaScript'

Difference between ‘==’ operator and ‘===’ operator in JavaScript

November 3rd, 2008 · 1 Comment · JavaScript

First try the following sample code, and have a quick look at the code.

<html>
<head>
<title>Test == and === operators in JavaScript </title>
<script type="text/javascript">
function testEqual(){
[...]

[Read more →]

Tags:

Handling HTML forms using jQuery Form Plugin

October 7th, 2008 · No Comments · JavaScript, jQuery

jQuery Form Plugin is a very useful JavaScript library which let you handle HTML forms in very flexible manner.

The jQuery Form Plugin allows you to easily and unobtrusively upgrade HTML forms to use AJAX. The main methods, ajaxForm and ajaxSubmit, gather information from the form element to determine how to manage the submit process. [...]

[Read more →]

Tags:

JavaScript and HTML Forms

October 6th, 2008 · No Comments · JavaScript

While I am implementing filtering support for Apache ODE Management Console’s Processes List, I have to interact with HTML form and validate some of the user inputs. Even though I know how interact with HTML forms using JavaScript, I feel that it’s better to understand the basic things behind HTML forms and JavaScript. The article [...]

[Read more →]

Tags:

JavaScript __noSuchMethod__ feature

August 19th, 2008 · No Comments · JavaScript, programming

Today I found this document while reading the Ajaxian. This ‘__noSuchmethid__’ of JavaScript object is same as Ruby’s ‘method_missing’ feature.

Example from above document:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
wittyProjectName.log = function log (message, type) {
if (type == 0) {
// log an error
}
else if (type == 1) {
// [...]

[Read more →]

Tags:

Secrets of the JavaScript Ninja: A sneak peak

August 15th, 2008 · No Comments · JavaScript, news

John Resig(Creator of jQuery) is working on the Secrets of the JavaScript Ninja book, which I am sure will be a great book for those who love JavaScript.

Here are some sneak peak chapters given out by Manning to Ajaxian:

Introduction
How Closures WorkClosures are one of the defining features of JavaScript, differentiating it from most other scripting [...]

[Read more →]

Tags:

Solution to XML namespace problem in getElementsByTagName

July 31st, 2008 · 1 Comment · JavaScript

Here is a simple code I used as a solution to XML namespace handling in different browsers(IE, Firefox 2, Firefox3, ..). But it requires more arguments like namespace and namespace frefix. But I think that this function can be improve based on problem that you have to solve.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function getElementsByTagName(tagName, ns, prefix, scope){
var elementListForReturn = scope.getElementsByTagName(prefix+&quot;:&quot;+tagName);
if(elementListForReturn.length [...]

[Read more →]

Tags:

Why Most Popular JavaScript libraries doesn’t support XML with namespaces?

July 28th, 2008 · No Comments · JavaScript, jQuery, yui

I am involve in developing Web Based Management Console for Apache ODE these days for Google Summer of Code 2008. For the mid term evaluation I used code developed using jQuery and I tested only in Firefox 2. But After I submit patches to ODE, developers mentioned about bugs in Firefox 3 and IE 7. [...]

[Read more →]

Tags:

DOM Scripting Toolkit - jQuery

June 15th, 2008 · No Comments · JavaScript, jQuery

I found this nice slides while I’am searching for a cross browser and easy to use DOM Scripting toolkit. The different APIs used by different browsers make it harder to write JavaScript which manipulate HTML documents. But toolkits like JQuery, Prototype, YUI, and etc.. make the JavaScript programmers life easier than before.

I think, now the [...]

[Read more →]

Tags: