Home
Name Modified Size InfoDownloads / Week
testformvalid.html 2010-12-15 5.7 kB
testpivot.html 2010-12-15 650 Bytes
testbsjs.html 2010-12-15 1.7 kB
readme.txt 2010-12-15 2.6 kB
basic_class.js 2010-12-15 19.9 kB
Totals: 5 Items   30.5 kB 0
JH-JS-Class

A Javascript class library to facilitate writting of web page with dynamic contents.

$aE is a function that has many sub functions. It is used for creating dynamic document elements.

You could, for example, create a table row by just calling $aE(myid).addTD(["a","b","c","d","e"])

It will create html "<tr><td>A</td><td>B</td><td>C</td><td>D</td><td>E</td></tr>" and add it as a child of the tbody element whose id is myid.

What I personally like the most is $aE(myid).get_E([2,3]). It will get the element as an object using the Javascript DOM tree navigation method. For example, I pass a tbody element id and it will return me the second TR, third TD element object. I could then do what ever I need to modify the element.

$vF(verificationtype, forminputobject,ojectfriendlyname, optional,optional) is only useful if you do form validation.

You could call as many $vF on the same element or elements before calling it witout parameters. Calling the function without parameters will actually output an alert message showing all the validation failures. It also clears the message.

$pT is a class library that does pivots. Normally pivots are done on the server side using sql like "select d,e,sum(a),sum(b) from tableC group by d,e". This will output a result that has two index (d and e) and two pivots (a and b).

However, that is only for one pivot table. If you require to see different pivots you will have to call the server multiple times. At other times you may want to see the details of the records also. This function allows you to download just once the data and create different pivots and allow user to view the raw data at the same time.

What you need is just to do 5 things.

1. Pass a ID of a tbody that will show the pivot.
2. Pass an array of the pivot fields (SQL SUM())
3. Pass an array of the index fields (SQL GROUP BY)
4. Pass a set of data as an array. Each set is one record. Index first then pivot.
5. Call the $pT.showTable function.

$cP is a popup window function that allow user to select a date. I make it simple and short. The syntax is just $cP(id,format). id is the input element id and format is MDY,DMY or YMD. YMD uses "-" as separator while the other two uses "/" as separator. I do not want to make the function complicated by adding a lot of funtionality. Once user selected a date, the value will be inserted into the element.

The html will look like this "<input type="text" name="mydate" id="md" readonly onclick="$cP(this.id,'MDY')">


As I go along, I will add more functionality. You are welcome to give suggestions.
Source: readme.txt, updated 2010-12-15