Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
3.2 KiB

  1. <% ' General depository for frequently used javascript functions ******* %>
  2. <% ' ******* Any localizable strings needed for these functions will appear in iijsfuncs.str ******* %>
  3. <!--#include file="iijsfuncs.str"-->
  4. <% ' ******* Pops open a new dialog of specified height, with or without an ok/cancel/help toolbar ******* %>
  5. <% ' ******* hideTools is optional ******* %>
  6. function popBox(title, width, height, filename, hideTools){
  7. thefile=(filename + ".asp");
  8. thefile="iipop.asp?pg="+thefile;
  9. if (hideTools)
  10. {
  11. thefile += "&tools=no";
  12. }
  13. //Store the window object in our Global variables, so it may be refered to from the parent window...
  14. top.title.Global.popwindow=window.open(thefile,title,"toolbar=no,scrollbars=yes,directories=no,menubar=no,width="+width+",height="+height);
  15. //pop it into a local var for reference here...
  16. popbox = top.title.Global.popwindow;
  17. //corrects for bug in ie where the window opener property wasn't being set.
  18. if(popbox !=null){
  19. if (popbox.opener==null){
  20. popbox.opener=self;
  21. }
  22. }
  23. //corrects for a bug where if the window is opened, and then re-opened, it stays in the back.
  24. //however, this errors in IE3, so we are special casing it. IE3 will have the less desirable
  25. //behavior of remaining in the background.
  26. <% if Session("isIE") and Session("browserver") < 4 then %>
  27. <% ' no focus... browser doesn't suppor it %>
  28. <% else %>
  29. popbox.focus();
  30. <% end if %>
  31. }
  32. <% ' ******* Basic Crop function based on string length ******* %>
  33. function crop(thestring,size){
  34. sLen = thestring.length
  35. if (sLen > size)
  36. {
  37. thestring = thestring.substring(0,size) + "...";
  38. }
  39. else{
  40. for (var i = sLen ; i < size; i++) {
  41. thestring = thestring + "&nbsp;"
  42. }
  43. }
  44. return thestring;
  45. }
  46. <% ' ******* Quick function to provide alternate text if there is no value to the main display string. ******* %>
  47. function displayVal(dispstr, altstr){
  48. if (dispstr == ""){
  49. dispstr = altstr;
  50. }
  51. return dispstr;
  52. }
  53. <% ' ******* Basic Numeric checker that displays a dialog. Strings are located in iijsfunc.str ******* %>
  54. function isNum(txtcntrl,min,max) {
  55. str=txtcntrl.value;
  56. minval = min-1;
  57. maxval = max+1;
  58. for (var i=0; i < str.length; i++) {
  59. num = parseInt(str.substring(i,i+1));
  60. if (isNaN(num)){
  61. alert("<%= L_ENTERINT %>");
  62. txtcntrl.value = txtcntrl.defaultValue;
  63. return false;
  64. }
  65. }
  66. num = str;
  67. if (min != ""){
  68. if (num < min) {
  69. alert('<%= L_GREATERTHAN %>');
  70. txtcntrl.value = txtcntrl.defaultValue;
  71. return false;
  72. }
  73. }
  74. if (max != ""){
  75. if (num > max) {
  76. alert('<%= L_LESSTHAN %>');
  77. txtcntrl.value = txtcntrl.defaultValue;
  78. return false;
  79. }
  80. }
  81. return true;
  82. }
  83. <% ' ******* Disables controls if the browser is DHTML compatible ******* %>
  84. function setCntrlState(mState,mControl){
  85. <% if Session("hasDHTML") then %>
  86. mControl.disabled = ! mState;
  87. <% end if %>
  88. }
  89. <% ' ******* Search for a string in a string ******* %>
  90. <% ' ******* I just don't like jscripts substring method... **** %>
  91. function bAnyInStr(sToSearch, sToFind)
  92. {
  93. for (i=0;i < sToFind.length;i++)
  94. {
  95. if (sToSearch.indexOf(sToFind.substring(i,i+1)) > -1)
  96. {
  97. return true;
  98. }
  99. }
  100. return false;
  101. }