Some JavaScript functions and code snippets useful for JavaScript Programmers and JS scripts.
New JavaScript Code Snippets might be added soon.

  1. Get Duration of Audio /Video file before Upload
  2. Refresh page if window width changes from a device size to other
  3. Shuffle / Randomize Array in JavaScript
  4. Zodiac Signs JavaScript code
  5. JavaScript strip_tags and stripslashes
  6. array_map and array_search in JavaScript
  7. JavaScript PHP is_ functions to test data type
  8. JavaScript trim, rtrim and ltrim
  9. Difference between two Dates - Time and Date
  10. Get Lower, Higher and Closest Number in JavaScript
  11. Get the value of the selected /checked checkboxes in a form
  12. Replace JavaScript variable name from string with its value
  13. Delete and Add CSS class
  14. Split an alphanumeric string into Array in JavaScript
  15. JavaScript base64 encode decode
  16. MD5 hash string in JavaScript
  17. SHA1 Encrypt data in JavaScript
  18. SHA256 Encrypt hash in JavaScript
  19. SHA512 Encrypt hash in JavaScript
  20. Get search data from URL address in JavaScript
  21. Get Domain Name and other Data from URL
  22. Disable button and Enable it after specified time
  23. Highlight Images on click
  24. Recursive function to create Multi-Level Menu in JavaScript
  25. Show and Hide HTML elements
  26. Select the Content of HTML Element
  27. Convert BBCode to HTML and HTML to BBCode with JavaScript
  28. Add Tag to Selected Text in textarea with JavaScript
  29. Detect when ScrollBar reaches the bottom of the page
  30. Get the Height and Width of web Page and browser Window
  31. Clear Canvas Context
  32. Add Text in Canvas from Input text field, as it is Typed
  33. Keep the first Nr IMG tags, Remove all the others
  34. Delete multiple consecutive characters and Split long words in JavaScript
  35. jQuery Drag and Drop Rows between two similar Tables
  36. Creating Tabs Effect with JavaScript
  37. Follow the mouse cursor with a DIV inside a Parent

Daily Test with Code Example

Which tag is used to include external CSS file in web page?
<body> <script> <link>
<link href="/templ/style.css" rel="stylesheet" type="text/css" />
Which CSS property sets the text size?
font-weight text-decoration font-size
h2 {
  font-size: 1em;
Indicate the JavaScript property that can add HTML code into an element.
text value innerHTML
document.getElementById("someID").innerHTML = "HTML content";
Click on the function that returns the number of characters of a string in PHP.
count() strlen() stristr()
$str = "";
$nr_chr = strlen($str);
echo $nr_chr;       // 22
JavaScript Code Snippets

Last accessed pages

  1. Voting Poll System script PHP-AJAX (1585)
  2. JavaScript Course - Free lessons (3244)
  3. Script Users Register, Login, Online (4927)
  4. Add Pause in JavaScript script (1869)
  5. Upload Script for Gallery of Images and Audio files (1977)

Top accessed pages

  1. PHP-MySQL free course, online tutorials PHP MySQL code (11401)
  2. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (11014)
  3. Get Attribute (ID, Class, Name, Title, Src) with jQuery (10635)
  4. PHP Chat Script (9782)
  5. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (9432)