/SQL/scripts/js/mla_sql.js

http://github.com/khaneh/Orders · JavaScript · 41 lines · 28 code · 6 blank · 7 comment · 13 complexity · 4adbb1fce2932626afc0f7449fb5b26d MD5 · raw file

  1. // Selects an item in a selection list
  2. function setSelectValue(pSelectObj, pValue, pDefault) {
  3. var myValue, i;
  4. (pValue == "") ? myValue = pDefault : myValue = pValue;
  5. for (i = 0; i < pSelectObj.length; i++)
  6. if (pSelectObj.options[i].value == myValue) { pSelectObj.selectedIndex = i; break; }
  7. return (1);
  8. }
  9. // Selects an item in a radio group
  10. function setRadioValue(pSelectObj, pValue, pDefault) {
  11. var myValue, i;
  12. (pValue == "") ? myValue = pDefault : myValue = pValue;
  13. for (i = 0; i < pSelectObj.length; i++)
  14. if (pSelectObj[i].value == myValue) { pSelectObj[i].checked = true; break; }
  15. return (1);
  16. }
  17. //opens a popup window
  18. function openPopUp(pURL, pName, pW, pH, pX, pY) {
  19. var myWindow = window.open(pURL, pName, "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + pW + ",height=" + pH);
  20. myWindow.moveTo(pX, pY);
  21. myWindow.focus();
  22. return (true);
  23. }
  24. // left trims
  25. function ltrim(pStr) {
  26. if (pStr == null) return ("");
  27. var myRegExp = new RegExp("^[ ]*", "gim");
  28. return (pStr.replace(myRegExp, ""));
  29. }
  30. // checks whether a text input is empty
  31. function isEmpty(pObj) { return (ltrim(pObj.value) == ""); }
  32. // checks whether a text input contains an integer
  33. function isInteger(pObj) { return (pObj.value.search(/[^0-9]/) == -1); }
  34. // displays a confirm dialog box then jumps to the specified location
  35. function _confirm(pTxt, pURL) { if (confirm(pTxt)) document.location = pURL; return (1); }