Home Demo Cnblog
 
 

JsJava means Java-formed Javascript,namely creating a series of Javascript objects similar to API of J2SE and J2EE and other opensource projects.With advanced Javascript objects,we may build complex web client business logic.

JsJava is an excellent Javascript library.In fact it's more than a Javascript library and it's also a Javascript infrastructure!

 
Introduction to JsJava2.2(http://www.jsjava.com)
 

JsJava in 2.2 comes into being.It mainly add or enhance some components such as splitor,selector and so on. It also add some document opertions mainly about document and form operations,key event and shortcut trigger, validator method and so on.It also fixed some bugs.

I now introduce the main contents of JsJava2.2.

JsJava2.2 implements splitor component,which supports horizontal and vertical split pane.This component is very useful like Java's class JSplitPane.e.g as follows:

<script src="jsjava-core.js"></script> <script src="jsjava-comp.js"></script> <script> function loadSplit(){ var pane2=new HTMLSplitPane(HTMLSplitPane.VERTICAL_SPLIT,"updiv2","downdiv2","splitdiv2"); pane2.show(); var pane3=new HTMLSplitPane(HTMLSplitPane.HORIZONTAL_SPLIT,"updiv3","downdiv3","splitdiv3"); pane3.show(); var pane4=new HTMLSplitPane(HTMLSplitPane.VERTICAL_SPLIT,"updiv4","downdiv4","splitdiv4"); pane4.show(); } EventUtils.addDomEvent(window,"load",loadSplit,false); document.onmouseup=f; function f(){status=new Date()}; </script> <body leftmargin="0" topmargin="0"> <table width="50%" align="center" border="1" cellpadding="0" cellspacing="0"> <tr> <td id="updiv2" height="100"> &nbsp; </td> </tr> <tr> <td id="splitdiv2"> <div style="height:3;width:100%;background-color:red"></div> </td> </tr> <tr> <td id="downdiv2" height="100"> &nbsp; </td> </tr> </table> <br> <table width="50%" align="center" border="1" cellpadding="0" cellspacing="0"> <tr> <td id="updiv3"> <table width="100%" height="200" align="center" border="1" cellpadding="0" cellspacing="0"> <tr> <td> <div id="updiv4" style="height:100"> &nbsp; </div> <div id="splitdiv4"> <div style="height:3;width:100%;background-color:red"></div> </div> <div id="downdiv4" style="height:100"> &nbsp; </div> </td> </tr> </table> </td> <td width="6" id="splitdiv3"> <div style="height:220;width:6;background-color:red;s"></div> </td> <td id="downdiv3"> &nbsp; </td> </tr> </table> </body> </html> The display:

JsJava2.2 implements shortcut trigger which can be used along with Ctrl,Shift and Alt key.e.g as follows:

<script src="jsjava-core.js"></script>s <script> function myfunc(){ alert("Success"); } function loadShortCut(){ EventUtils.setCtrlMnemonic(document.body,"V",myfunc,false); } EventUtils.addDomEvent(window,"load",loadShortCut,false); </script> The display:
You'll see a dialog which hints success.

JsJava2.2 implements enhanced the html selector component.It's mainly be added some operation between two selector component,such as adding the selected options of a selector to the other selector,moving the selected options upforward or downward and so on.

<script src="jsjava-core.js"></script> <script src="jsjava-comp.js"></script> <script> var hs1; var hs2; window.onload=function(){ hs1=new HTMLSelector(document.myForm.s1); hs2=new HTMLSelector(document.myForm.s2); } function f1(){ hs1.addSelectedOptionsTo(hs2,true); } function f2(){ hs2.removeSelectedOptions(); } function f3(){ hs2.removeAll(); } function f4(){ hs2.moveUp(); } function f5(){ hs2.moveDown(); } </script> <form name="myForm"> <table border="0"> <tr> <td> <select name="s1" multiple size="10"> <option value='1'>username</option> <option value='2'>age</option> <option value='3'>birthday</option> <option value='5'>address</option> <option value='6'>blood</option> <option value='7'>hobby</option> </select> </td> <td> <input type="button" value="add" onclick="f1()"><br> <input type="button" value="remove" onclick="f2()"><br> <input type="button" value="clear" onclick="f3()"><br> <input type="button" value="move up" onclick="f4()"><br> <input type="button" value="move down" onclick="f5()"> </td> <td> <select name="s2" multiple size="10"> </select> </td> </tr> </table> The display:

JsJava2.2 implements keyboard event and dealer.For example,you can get the key code or the key label:

<script src="jsjava-core.js"></script> <script> document.onkeydown=judge; function judge(){ var keyCode=EventUtils.getKeyCode(); alert("is entry key:"+KeyUtils.isEnterKey(keyCode)); } </script> The display:

JsJava2.2 also fixed some bugs posted by JsJava developers in practice.Here not listed in detail.

JsJava2.2 passed IE5,IE6,IE7 and Fifefox2.0 test.It had no test on Opera,Maxthon,MinIE and other browsers.

With JsJava2.2,you'll become a page solution superior!


Copyright 2006-2008 jsjava.com All right reserved
team:jsjava#gmail.com author:freeeob#gmail.com