PageSourceSearch

https://jssuni.edu.in/js/SysSoft.js

js jssuni.edu.in collected 2026-10-02 17:43:53 UTC 12,473 bytes, 467 lines download raw bytes

1//
2//Changes Email function as On 20/12/2009 by tanuj
3//Changes valid Mobile function as On 20/12/2009 by tanuj
4
5function NewWindow(mypage,myname,w,h,scroll, resize)
6{
7  var win = null;
8  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
9  TopPosition = (screen.height) ? (screen.availHeight-h)/2 - 2 : 0;
10  settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
11  //settings = settings + 'fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no';
12  if (resize == 'yes') settings += ',resizable';
13  win = window.open(mypage,myname,settings);
14}
15
16function CenteredWindow(mypage,myname,w,h,scroll, resize)
17{
18  var win = null;
19  //var ScreenWidth = 980;
20  var ScreenWidth = screen.width;
21  LeftPosition = (ScreenWidth) ? (ScreenWidth-w)/2 : 0;
22  TopPosition = (screen.height) ? (screen.availHeight-h)/2 - 2 : 0;
23  settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
24  //settings = settings + 'fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no';
25  if (resize == 'yes') settings += ',resizable';
26  win = window.open(mypage,myname,settings);
27}
28
29//For Form, textboxes
30function setControlDefaultButton(pstrDefaultButton)
31{
32if(event.which || event.keyCode)
33  if ((event.which == 13) || (event.keyCode == 13)) 
34  {
35    if (pstrDefaultButton.length > 0) document.getElementById(pstrDefaultButton).click();
36    return false;
37  }
38  return true;
39}
40
41function getValue(pstr)
42{
43  return document.getElementById(pstr).value;
44}
45
46function setValue(pstr, value)
47{
48  document.getElementById(pstr).value = value;
49}
50
51function setFocusAndSelect(pstr)
52{
53  var obj=document.getElementById(pstr);
54  if (obj != null)
55  {
56    obj.focus();
57    obj.select();
58    
59  }
60}
61
62function initialFocus(pstr)
63{
64  document.getElementById(pstr).focus();
65}
66
67function upperCase(pstrFieldName)
68{
69var str=document.getElementById(pstrFieldName).value;
70document.getElementById(pstrFieldName).value=str.toUpperCase();
71}
72
73function email(pstrFieldName, pstrMessage) {
74var email = document.getElementById(pstrFieldName);
75var intIndex = -1;
76
77intIndex = email.value.indexOf("..");
78if (intIndex != -1) {
79    alert("Two consecutive dots are not allowed.");
80    email.focus();
81	email.select();      
82	return false;
83}
84var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
85if (!filter.test(email.value)) {
86alert(pstrMessage);
87email.focus;
88return false;
89}
90return true;
91}
92
93function selectedOptionButton(strRadioButton)
94{
95  var obj;
96  obj=document.getElementById(strRadioButton); 
97  for (var i=0;i < obj.length; i++) {
98    if (obj.item(i).checked) {
99      return obj.item(i).value;
100    }
101  }
102  return ' ';
103}
104
105function selectedOptionButtonByGroupName(strRadioButtonGroupName)
106{
107  var objSelected = document.getElementsByName(strRadioButtonGroupName); 
108  for (x = 0; x < objSelected.length; x++)
109  { 
110    if (objSelected[x].checked) {
111      return objSelected[x].value; 
112    }
113  }
114  return ' ';
115}
116
117
118function IsValidPassword(strFieldName, Message)
119{
120  var obj;
121  strValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$^()-_+=?/|\<>[]{}";
122  obj = document.getElementById(strFieldName);
123  
124  if (obj == null) return true;
125  
126  ReturnString = removeSpaces(obj.value);
127  obj.value = ReturnString;
128  
129  str = obj.value;
130  strInputWithUcase = str;
131  
132  if(ReturnString.length == 0)
133    {
134      alert(Message + ".");
135      obj.focus();
136      obj.select();      
137      return false;
138    }  
139
140   //   checking for minlen
141  
142  if(ReturnString.length < 6)
143    {
144      alert(Message + " correctly. \n\n(Characters can not be less than 6)");
145      obj.focus();
146      obj.select();      
147      return false;
148    }  
149      
150               //   checking for maxlen
151  if(obj.value.length > 15)
152    {
153      alert(Message + " correctly. \n\n(Characters can not be more than 15. Currently " + obj.value.length + " entered)");
154      obj.focus();
155      obj.select();      
156      return false;
157    }
158 
159              //  checking for invalid characters 
160
161 for (i = 0; i < obj.value.length; i++) 
162  {           // Searching through string
163
164     var c = strInputWithUcase.charAt(i);
165     if (strInputWithUcase.charCodeAt(i) != 13 && strInputWithUcase.charCodeAt(i) != 10) 
166     {
167       if (strValidChars.indexOf(c) == -1)
168       {
169          alert(Message + " correctly (Invalid Character: " + c + ").");
170          obj.focus();
171          obj.select();      
172          return false;
173        }  
174      }
175  }
176  
177  return true;  
178}
179
180
181function IsValidEntry(strFieldName, intMinLen, intMaxLen, strValidChars, blnCaseSensitive, Message)
182{
183  var obj;
184  obj = document.getElementById(strFieldName);
185  
186  if (obj == null) return true;
187  
188  ReturnString = removeSpaces(obj.value);
189  obj.value = ReturnString;
190  
191  str = obj.value;
192  if (blnCaseSensitive) 
193  {
194     strInputWithUcase = str;
195  }
196  else
197  {
198     strInputWithUcase = str.toUpperCase();
199  }
200  
201  if(ReturnString.length == 0 && intMinLen != 0)
202    {
203      alert(Message + ".");
204      obj.focus();
205      obj.select();      
206      return false;
207    }  
208
209   //   checking for minlen
210  if(ReturnString.length < intMinLen)
211    {
212      alert(Message + " correctly. \n\n(Characters can not be less than " + intMinLen + ")");
213      obj.focus();
214      obj.select();      
215      return false;
216    }  
217      
218               //   checking for maxlen
219  if(obj.value.length > intMaxLen)
220    {
221      alert(Message + " correctly. \n\n(Characters can not be more than " + intMaxLen + ".  Currently " + obj.value.length + " entered)");
222      obj.focus();
223      obj.select();      
224      return false;
225    }
226    
227              // if ValidChars is Empty string than any input can be taken  
228  if(strValidChars.length == 0) 
229    {
230      
231      return true;
232    }
233   //alert(strFieldName + " " + strValidChars.length + " " + strValidChars);
234
235              //  checking for unvalid characters 
236 for (i = 0; i < obj.value.length; i++) 
237  {           // Searching through string
238
239     var c = strInputWithUcase.charAt(i);
240     if (strInputWithUcase.charCodeAt(i) != 13 && strInputWithUcase.charCodeAt(i) != 10) 
241     {
242       if (c=="\\")c="\\"; //Add this if condition for matching \(backslash character) in a string
243       if (strValidChars.indexOf(c) == -1)
244       {
245          alert(Message + " correctly (Invalid Character: " + c + ").");
246          obj.focus();
247          obj.select();      
248          return false;
249        }  
250      }
251  }
252  return true;  
253}
254
255  // fn is required with IsValidEntry
256function removeSpaces(string) 
257{
258  var temp;
259  temp = string;
260  while (!(temp.indexOf('  ') == -1))
261  {
262    temp = temp.replace('  ',' ');
263  }
264  
265  if (temp.charAt(0)  == ' ')
266   {
267    temp = temp.substring(1, temp.length);
268   }
269  
270  if (temp.charAt(temp.length - 1)  == ' ')
271   {
272    temp = temp.substring(0, temp.length - 1);
273   }
274  return temp;
275}
276
277function validMobile(pstrFieldName)
278 {
279   var character;
280   character=document.getElementById(pstrFieldName).value;
281   if (character.charAt(0) != "9" && character.charAt(0) != "8" && character.charAt(0) != "7")
282    {
283      alert("Mobile # first character must be 7, 8 or 9");
284      document.getElementById(pstrFieldName).select();
285      document.getElementById(pstrFieldName).focus();
286      return false;
287    }   
288 
289  return true; 
290}
291
292function validateMobileNo(pstrFieldName) {
293    var strMobileString = "";
294    var astrMobileNos = "";
295    var intCount = 0;
296    var intMobileCount = 0;
297
298    strMobileString = getValue(pstrFieldName);
299
300    if (Trim(strMobileString).length == 0) return true;
301
302    strMobileString = Trim(strMobileString);
303
304    strMobileString = strMobileString.replace(',', ' ');
305    strMobileString = strMobileString.replace('  ', ' ');
306
307    astrMobileNos = strMobileString.split(' ');
308
309    intMobileCount = astrMobileNos.length;
310    //alert(intMobileCount);
311    for (intCount = 0; intCount < intMobileCount; intCount++) {
312        //alert(intCount + " L:" + astrMobileNos[intCount].length);
313        if (((astrMobileNos[intCount].length) == 10) && ((astrMobileNos[intCount].charAt(0) == "9") || (astrMobileNos[intCount].charAt(0) == "8") || (astrMobileNos[intCount].charAt(0) == "7"))) {
314            //Every thing is fine here
315        }
316        else {
317            alert("Mobile # must be 10 digit and first character must be 7, 8 or 9. \r\nIncorrect Mobile No. : " + astrMobileNos[intCount]);
318            document.getElementById(pstrFieldName).select();
319            document.getElementById(pstrFieldName).focus();
320            return false;
321        }
322    }
323
324    return true;
325}
326
327
328function initialFocus(pstr)
329{
330//  document.form1.item(pstr).focus();
331  document.getElementById(pstr).focus();
332}
333
334function Trim (pstr)
335{
336return pstr.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
337}
338
339function getURLParameters() 
340{
341	var sURL = window.document.URL.toString();
342	
343	if (sURL.indexOf("?") > 0)
344	{
345		var arrParams = sURL.split("?");
346			
347		var arrURLParams = arrParams[1].split("&");
348		
349		var arrParamNames = new Array(arrURLParams.length);
350		var arrParamValues = new Array(arrURLParams.length);
351		
352		var i = 0;
353		for (i=0;i<arrURLParams.length;i++)
354		{
355			var sParam =  arrURLParams[i].split("=");
356			arrParamNames[i] = sParam[0];
357			if (sParam[1] != "")
358				arrParamValues[i] = unescape(sParam[1]);
359			else
360				arrParamValues[i] = "No Value";
361		}
362		
363		for (i=0;i<arrURLParams.length;i++)
364		{
365			alert(arrParamNames[i]+" = "+ arrParamValues[i]);
366		}
367	}
368	else
369	{
370		alert("No parameters.");
371	}
372}
373
374
375function GetParamterValue ( ParameterName )
376{
377var url = window.document.URL.toString();
378if ( url.indexOf ("?") > 0 )
379{
380var Parameters = url.split ("?") [ 1 ].split ("&");
381for ( i = 0; i < Parameters.length; i++ )
382{
383if ( Parameters [ i ].indexOf ("=") > 0 )
384{
385var ParameterValue = Parameters [ i ].split ("=");
386if ( ParameterValue [ 0 ] == ParameterName )
387return ParameterValue [ 1 ];
388}
389}
390}
391return "";
392}
393
394//function setTextForControl(pobjControl, pstrText, pobjActualControl) {
395//    if (getValue(pobjControl).length == 0)
396//    { document.getElementById(pobjControl).value = pstrText; }
397////    else if (document.getElementById(pobjControl).value != pstrText)
398////    { document.getElementById(pobjControl).value = ""; }
399
400//    if (document.getElementById(pobjActualControl).value == pstrText) {
401//        document.getElementById(pobjControl).value = "";
402//    }
403//}
404
405//function CheckDecimal(inputtxt, pstrMessage) {
406//    var mstrTextValue = "";
407//    mstrTextValue = document.getElementById(inputtxt).value;
408
409//    if (mstrTextValue.toString().indexOf(".") > 0) {
410//        var regexp = /^\d+\.\d{0,2}$/;
411//        if (!regexp.test(document.getElementById(inputtxt).value)) {
412//            alert(pstrMessage);
413//            document.getElementById(inputtxt).focus()
414//            return false;
415//        }
416//    }
417//    return true;
418//}
419
420function chkDecimals(pstrFieldName, pstrMessage, pintMaxDigitAfterDecimal) {
421    var strPrice;
422    var intIndex = -1;
423    var intCounter = 1;
424    var strTempString = "";
425    strPrice = document.getElementById(pstrFieldName);
426
427    var i = 0;
428    while (i < strPrice.value.length) {
429        if (strPrice.value.charAt(i) != ".") {
430            i++;
431        }
432        else {
433            if (intCounter == 1) {
434                intCounter = intCounter + 1;
435                i++;
436            }
437            else {
438                alert(pstrMessage + ". correctly (Invalid Character: " + strPrice.value.charAt(i) + ")");
439                strPrice.focus();
440                strPrice.select();
441                return false;
442            }
443        }
444    }
445
446
447    intIndex = strPrice.value.indexOf(".");
448    if (intIndex != -1) {
449        strTempString = strPrice.value.substring(intIndex + 1, strPrice.value.length);
450        if (strTempString.length > pintMaxDigitAfterDecimal) {
451            alert(pstrMessage + ", decimal digits greater than " + pintMaxDigitAfterDecimal + ".");
452            strPrice.focus();
453            strPrice.select();
454            return false;
455        }
456    }
457
458    return true;
459}
460
461
462
463
464
465
466
467

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.