Welcome To Snipplr


Everyone's Recent JavaScript Snippets Tagged function



« Prev 1 2
  1. FAV

    Recursive parental function callers

    This snippet allows to know the parent function caller name of any level from the calling function.
    JavaScript saved by 2 people 4 views posted 5 years ago by zandor
  2. FAV

    Template for a Javascript function with optional and mandatory arguments passed as an object collection

    A simple template for a JavaScript function which allows for an arbitrary number of named arguments to be passed in. This is achieved by passing a single object as an argument with each of the 'real' arguments being a key/value pair. In this way argu...
    JavaScript 12 views posted 7 years ago by davidwaterston
  3. FAV

    A function that uses images to perform a countdown.

    Set the desired date within the function. Make some images and label them "1.jpg, 2.jpg, 3.jpg, etc...". That's how it's done.
    JavaScript saved by 3 people 5 views posted 7 years ago by o0110o
  4. FAV

    Function to simulate PHP $_GET in javascript

    Simulate the $_GET array from php in javascript to get url parameters this way: url= http://localhost/?var1=example $_GET['var1'] will return "example" Just copy and paste the code.
    JavaScript saved by 6 people 8 views posted 7 years ago by sergiazow
  5. FAV

    Using call to invoke an anonymous function

    In this purely constructed example, we create anonymous function and use call to invoke it on every object in an array. The main purpose of the anonymous function here is to add a print function to every object, which is able to print the right index...
    JavaScript 2 views posted 7 years ago by hellowouter
  6. FAV

    JavaScript Function Default Arguments (Full Object Merge)

    This snippet uses jQuery.extend() to merge the objects.
    JavaScript 1 views posted 7 years ago by viskenxp
  7. FAV

    Optional function arguments/parameters by using associative array

    By not being limited to provide certain arguments/parameters in right order when calling a function, makes the function more versatile and easier to extend without breaking old code (e.g. calls to the function). One solution is to pass an associati...
    JavaScript 5 views posted 8 years ago by coprolit
  8. FAV

    addLoadEvent function

    Description: Execute different functions when the page loads in a better way than default onload JS event. Include it in the end of the JS document. Arguments: Name of the function that you want to execute when the page loads. Author: Simon Williso...
    JavaScript 1 views posted 8 years ago by alberomo
  9. FAV

    Call IFrame Javascript function from parent document/window

    This snippet lets you call a Javascript function declared within an IFrame from the parent element of the IFrame
    JavaScript 10 views posted 8 years ago by alexscript
  10. FAV

    Self invocking javascript function

    JavaScript saved by 3 people 2 views posted 9 years ago by YA
  11. FAV

    Check or Uncheck all Checkboxes

    JavaScript saved by 2 people 2 views posted 9 years ago by fauverism
  12. FAV

    javascript function within a function to repeat itself js jquery jq loop looping

    JavaScript 4 views posted 9 years ago by brandonjp
  13. FAV

    Random Number (Float) Generator

    Simple function to return a decimal value between the minValue and the maxValue.
    JavaScript 4 views posted 9 years ago by Jamie
  14. FAV

    Random Number (Integer) Generator

    Simple function to return a value between the minValue and the maxValue.
    JavaScript 3 views posted 9 years ago by Jamie
  15. FAV

    MOOTOOLS JS - Clear input field onClick onFocus on click focus active

    JavaScript 0 views posted 9 years ago by brandonjp
  16. FAV

    jsCookies - my simple easy pure js javascript cookies function

    JavaScript saved by 21 people 18 views posted 9 years ago by brandonjp
  17. FAV

    Object Runtime Fields Evaluator

    Runtime Object Evaluator; search for string object properties that start with !! and eval the content. Very useful if you want to load JSON from file and evaluate its fields on effective usage or access global variables at runtime. [Follow me on T...
    JavaScript saved by 2 people 0 views posted 10 years ago by straps
  18. FAV

    When to use the prototype of a Function

    Assign methods to a Function prototype when you intend to create instances of the type of object. Use object literals when you just need a container for functions.
    JavaScript 3 views posted 10 years ago by segdeha
  19. FAV

    add up any number of parameters

    just testing snipplr.com
    JavaScript 1 views posted 10 years ago by cfleschhut
  20. FAV

    Get Function Name

    Get Function Name ============ This will only return (a string) if the object passed to getFunctionName is a function or an "object" function from IE. The function does not rely on function.name if present as it can't always be trusted. Examp...
    JavaScript 2 views posted 10 years ago by Sephr
  21. FAV

    Element Collection Manipulation Shortcut Using MooTools 1.2

    JavaScript 1 views posted 11 years ago by ianmonge
  22. FAV

    Javascript image preload object

    How to use: 1) < script type="text/javascript" src="path-to-file.js"... 2) < body onload="oHW.preMontar('img1_on.jpg','img2_on.jpg','img3_on.jpg');"... 3) < a href="#" onmouseout="oHW.Restore()" onmouseover="oHW.Cambiar('mnind','img1_on.jpg'...
    JavaScript saved by 6 people 5 views posted 11 years ago by hellion
  23. FAV

    Elapsed time string from time in seconds

    JavaScript 5 views posted 11 years ago by wbowers
  24. FAV

    Function invocation and 'this' Context Example

    Quick example to show how 'this' depends on how the function in which you called it in was being invoked. From jQuery in Action.
    JavaScript saved by 1 person 2 views posted 11 years ago by 1man
  25. FAV

    adding .first() ability to jquery chain

    JavaScript 0 views posted 12 years ago by natalie
  26. FAV

    Javascript Closure

    Apologies if I haven't explained this to well, I'm still trying to get my head round closures.
    JavaScript 3 views posted 12 years ago by 1man
  27. FAV

    Function call() Method

    This method allows you to call a function as a method of another object. The first argument the call method expects is the object it is to operate on. Any others are part of the function. Note how the this keyword now refers to the comp object, so a...
    JavaScript 1 views posted 12 years ago by 1man
  28. FAV

    Array Functions as Data

    The important thing to notice is the () operator in a[2]. It is invoking the function inside a[0] with the argument a[1].
    JavaScript saved by 3 people 2 views posted 12 years ago by 1man
  29. FAV

    Accessing Arguments Using the Arguments Object

    Every function has an object called the arguments object. This is an object that contains all the arguments that were passed to the function. The example below shows how to access these. Very rarely used but useful to know. Note: it may look like an...
    JavaScript saved by 4 people 5 views posted 12 years ago by 1man
  30. FAV

    Optional Function Arguments

    Simple way of allowing functions to take optional arguments. Always place the optional arguments last, so you don't have to explicitly pass an argument as "undefined".
    JavaScript saved by 6 people 4 views posted 12 years ago by 1man
« Prev 1 2