helperJSSample_공통기능스크립트샘플.xrw 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?xml version="1.0" encoding="EUC-KR"?>
  2. <?xml-stylesheet type="text/css" href="../../../com/commonweb/css/common.css" ?>
  3. <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
  4. <xhtml:head>
  5. <xhtml:title>Untitle</xhtml:title>
  6. <model id="model1">
  7. <instance id="instance1">
  8. <root xmlns="">
  9. <example>Sample</example>
  10. <dateValue/>
  11. <fromData/>
  12. <endData/>
  13. <numData/>
  14. <strData/>
  15. <residentno/>
  16. <textareadata/>
  17. <weekvalue/>
  18. </root>
  19. </instance>
  20. </model>
  21. <script type="javascript" src="../../../com/commonweb/js/dateHelper.js"/>
  22. <script type="javascript" src="../../../com/commonweb/js/stringHelper.js"/>
  23. <script type="javascript" src="../../../com/commonweb/js/utilHelper.js"/>
  24. <script type="javascript" src="../../../com/commonweb/js/numericHelper.js"/>
  25. <script type="javascript" src="../../../com/commonweb/js/tfHelper.js"/>
  26. </xhtml:head>
  27. <xhtml:body>
  28. <input id="input1" ref="/root/dateValue" inputtype="date" style="left:435px; top:40px; width:100px; height:20px; "/>
  29. <button id="button1" class="btn2_letter6" style="left:565px; top:40px; width:100px; height:20px; ">
  30. <caption>getAddDate</caption>
  31. <script type="javascript" ev:event="DOMActivate">
  32. <![CDATA[
  33. var addDy = model.getValue("/root/dateValue");
  34. addDy = addDy.toDate().getAddDate(-1,"Y");
  35. addDy = addDy.getDateFormat();
  36. alert(addDy);
  37. ]]>
  38. </script>
  39. </button>
  40. <input id="input2" ref="/root/endData" inputtype="date" style="left:440px; top:75px; width:100px; height:20px; "/>
  41. <input id="input3" ref="/root/fromData" inputtype="date" style="left:320px; top:75px; width:100px; height:20px; "/>
  42. <button id="button2" class="btn2_letter8" style="left:565px; top:74px; width:100px; height:20px; ">
  43. <caption>getDateInterval</caption>
  44. <script type="javascript" ev:event="DOMActivate">
  45. <![CDATA[
  46. var diffDate = getDateInterval(model.getValue("/root/fromData"), model.getValue("/root/endData"));
  47. alert(diffDate);
  48. ]]>
  49. </script>
  50. </button>
  51. <caption id="caption1" style="left:425px; top:75px; width:12px; height:20px; vertical-align:middle; ">~</caption>
  52. <button id="button3" class="btn2_letter10" style="left:565px; top:108px; width:130px; height:20px; ">
  53. <caption>getCurrentDateTime</caption>
  54. <script type="javascript" ev:event="DOMActivate">
  55. <![CDATA[
  56. alert(getCurrentDateTime());
  57. ]]>
  58. </script>
  59. </button>
  60. <button id="button4" class="btn2_letter5" style="left:565px; top:142px; width:100px; height:20px; ">
  61. <caption>getFullAge</caption>
  62. <script type="javascript" ev:event="DOMActivate">
  63. <![CDATA[
  64. var residentno = model.getValue("/root/residentno");
  65. alert(getFullAge(residentno));
  66. ]]>
  67. </script>
  68. </button>
  69. <button id="button5" class="btn2_letter8" style="left:685px; top:75px; width:100px; height:20px; ">
  70. <caption>getTimeInterval</caption>
  71. <script type="javascript" ev:event="DOMActivate">
  72. <![CDATA[
  73. var diffTime = getTimeInterval("11:11:22","11:11:33");
  74. alert(diffTime);
  75. ]]>
  76. </script>
  77. </button>
  78. <button id="button6" class="btn2_letter5" style="left:565px; top:175px; width:100px; height:20px; ">
  79. <caption>getRound</caption>
  80. <script type="javascript" ev:event="DOMActivate">
  81. <![CDATA[
  82. var rtn = model.getValue("/root/numData");
  83. var toNum = rtn.getRound(-2, "UP");
  84. alert(toNum);
  85. ]]>
  86. </script>
  87. </button>
  88. <input id="input4" ref="/root/numData" roundmode="round" roundposition="2" style="left:460px; top:175px; width:100px; height:20px; ">
  89. <script type="javascript" ev:event="onkeyup">
  90. <![CDATA[
  91. inputEnterKey("button6");
  92. ]]>
  93. </script>
  94. </input>
  95. <button id="button7" class="btn2_letter7" style="left:565px; top:205px; width:100px; height:20px; ">
  96. <caption>getRightPad</caption>
  97. <script type="javascript" ev:event="DOMActivate">
  98. <![CDATA[
  99. var rtnStr = model.getValue("/root/strData");
  100. rtnStr = rtnStr.getRightPad(10,"$");
  101. alert(rtnStr);
  102. ]]>
  103. </script>
  104. </button>
  105. <input id="input5" ref="/root/strData" style="left:460px; top:205px; width:100px; height:20px; "/>
  106. <input id="input6" ref="/root/residentno" style="left:460px; top:140px; width:100px; height:20px; "/>
  107. <button id="button8" class="btn2_letter5" style="left:565px; top:365px; width:100px; height:20px; ">
  108. <caption>isByteSize</caption>
  109. <script type="javascript" ev:event="DOMActivate">
  110. <![CDATA[
  111. var str = model.getValue("/root/textareadata");
  112. alert(str.isByteSize(10));
  113. ]]>
  114. </script>
  115. </button>
  116. <textarea id="textarea1" ref="/root/textareadata" maxlength="50" style="left:360px; top:235px; width:200px; height:150px; "/>
  117. <button id="button9" class="btn2_letter8" style="left:555px; top:15px; width:108px; height:19px; ">
  118. <caption>getDayOfWeek</caption>
  119. <script type="javascript" ev:event="DOMActivate">
  120. <![CDATA[
  121. alert(model.getValue("/root/weekvalue").toDate().getDayOfWeek("K"));
  122. ]]>
  123. </script>
  124. </button>
  125. <input id="input7" ref="/root/weekvalue" inputtype="date" style="left:450px; top:15px; width:100px; height:20px; "/>
  126. </xhtml:body>
  127. </xhtml:html>