Sunday, March 2, 2008

Javascript

How to call Client side code from server side

How to show message If client is disabled a specified time

How to get input element value which stay inside a td
Say the html is like following ..
1>first create the table object
objTable = document.getElementById("TABLEID");
objTR = objTable.getElementsByTagName("tr")[0];
objTD = objTR.getElementsByTagName("td")[0];
objInput = objTD.getElementsByTagName("INPUT")[0];
alert(objInput.value);
Result:test
How to get parent node from a click event
click event fire here In the above structure we will find a parent element from a click event.
Javascript Object
1.ArraYObj = {}; =>In javascript this way we can define an array obj
2.ArrayObj = new Array();
obj = function(){}=>This way we can define a function and here the function behave as object
Note:1.An element's offsetLeft and offsetTop properties return the pixel distance the element is offset from its offsetParent.The main offsetParent is body but
In the above ex referenc to the image id offset parent is <td>

After creating a event object in the following way we can call a function at the time of fire an event.

eventobj = document.getElementById('testeventid');
eventobj["onclick"] = function() { alert("ok");};
eventobj["onmouseover"] = function() { alert("bk");};

Singletone javascript function


In Javascript we can alocate a value into a member of an object and simultaneously call a function like the following way
testFunction().value2 = "test";

No comments: