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