Icontem

jsCommonFunctions: Manipulate text, arrays and get browser details

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2010-08-28 (6 years ago) RSS 2.0 feedNot enough user ratingsTotal: 385 This week: 1All time: 81 This week: 22Up
Version License JavaScript version Categories
js-common-functions 1.0Free For Educatio...1.0Browser, Events
Description Author

This object provides general purpose functions to manipulate text strings, arrays and get browser details. Currently it can:

- Trim strings
- Validate e-mail addresses
- Split a string into an array
- Check if a value is in an array
- Get mouse pointer position in an event
- Check the browser type
- Get the last character of a string of element of an array
- Get an element of the current document by identifier

Picture of Er. Rochak Chauhan
Name: Er. Rochak Chauhan <contact>
Classes: 1 package by
Country: India India

Details
Usage:

// Create object
var jcf = new jsCommonFunctions();
// Call
jcf.{FUNCTION_NAME}; 




Example:
<script type="text/javascript" src="jsCommonFunctions.js"></script>
<script type="text/javascript">
	var jcf = new jsCommonFunctions();
	var str="      abc      ";
	str=jcf.trim(str);
</script>





Complete JavaScript Function List:

   1. lTrim(string):
          * Function to trim all the white spacing from the left side of any string.
   2. rTrim(string):
          * Function to trim all the white spacing from the right side of any string.
   3. trim(string):
          * Function to trim all the white spacing from left and right side of the string.
   4. isValidEmail(string):
          * Function to validate a typical email pattern.
   5. getType(variable_name):
          * Function to find the type of the variable. A Clone of PHP\’s “var_dump()” function.
   6. inArray(array, string):
          * Function to find if the string is in the array. Clone of PHP\’s “in_array()” function.
   7. inArrayI(array, string):
          * Function to find if the string is in the array. Clone of PHP\’s “in_array()” function. (its case insensitive)
   8. getMouseX(event):
          * Function to find the current X position of the mouse/cursor.
   9. getMouseY(event):
          * Function to find the current Y position of the mouse/cursor.
  10. getMouseXY(event):
          * Function to find the current X and Y positions of the mouse/cursor as an array.
  11. getBrowserName():
          * Function to return the name of the web browser.
  12. isBrowserIe():
          * Function to return “true” if the browser is “Microsoft Internet Explorer” else return “false“.
  13. isBrowserOpera():
          * Function to return “true” if the browser is “Opera” else return “false“.
  14. isBrowserNetscape():
          * Function to return “true” if the browser is “Firefox” or “Netscape” else return “false“.
  15. getTotalImages():
          * Function to return the number of images used in the current page.
  16. explode(delimiter, string):
          * Function to Split a string by a specified delimiter. A Clone of PHP\’s “explode” function.
  17. end(string / array):
          * Function to return the last character of a string or the last element of the array. A Clone of PHP\’s “end” function.
  Files folder image Files  
File Role Description
Plain text file jsCommonFunctions.js Class Class File
Accessible without login Plain text file Readme.txt Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 0%
Total:385
This week:1
All time:81
This week:22Up