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 HTML element can be used to embed a SWF flash content?
<object> <div> <script>
<object type="application/x-shockwave-flash" data="file.swf" width="500" height="250">
 <param name="src" value="file.swf" />
 Your browser not support SWF.
Which CSS pseudo-class adds a style to an input form field that has keyboard input focus?
:active :focus :hover
input:focus {
  background-color: #88fe88;
Click on the instruction which converts a JSON string into a JavaScript object.
JSON.stringify(javascript_object) object.toString() JSON.parse(json_string)
var jsnstr = '{"url": "", "title": "Web Development Courses"}';
var obj = JSON.parse(jsnstr);
Indicate the PHP function which can be used to create or write a file on server.
fopen() file_put_contents() file_get_contents()
if (file_put_contents("file.txt", "content")) echo "The file was created";
else echo "The file can not be created";
JavaScript Code Snippets

Last accessed pages

  1. $_GET, $_POST and $_REQUEST Variables (4822)
  2. Register and show online users and visitors (2493)
  3. Highlight Images on click (362)
  4. Chaining multiple jQuery effects (581)
  5. Merge Drawing and Object Drawing (367)

Top accessed pages

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