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

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

Daily Test with Code Example

Which attribute specifies the HTTP method (GET, POST) used to submit the form-data?
action method value
<form action="script.php" method="post"> ... </form>
Which CSS property allows to add shadow to boxes?
background-image box-shadow border-radius
#id {
  background-color: #bbfeda;
  box-shadow: 11px 11px 5px #7878da;
Which function removes the first element from an array?
pop() push() shift()
var fruits = ["apple", "apricot", "banana"];
alert(fruits.length);           // 2
Indicate the function that can be used to check if a PHP extension is instaled.
function() filetype() extension_loaded()
if(extension_loaded("PDO") === true) echo "PDO is available."
JavaScript Code Snippets

Last accessed pages

  1. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (5435)
  2. CSS Float and Clear (302)
  3. Get and Modify content of an Iframe (1149)
  4. Difference between two Dates - Time and Date (143)
  5. Register and show online users and visitors (1712)

Top accessed pages

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