Anti Iframe Buster by Lex Johnson
DOM Append Text and Element Functions
A Modular Toolbox
This function splits any well-formed URI into its parts (all are optional). All parts are split with a single regex using backreferences, and all groupings which don't contain complete URI parts are non-capturing.
Unequal column heights make CSS layouts difficult to manage when the height of content cannot be known in advance, particularly in scenarios where absolute positioning is in use. While there are a variety of strategies to deal with this issue, here's a jQuery-based fix.
Add event listeners for all browsers at once. Easy to use, for all browsers.
Detecting Google Chrome
Need to check Google's new browser to see if it has a quirk that none of the other browsers have? You can detect Chrome by using this snippet in your scripts.
Use this snippet to display text on a Web page when testing and doing design layout work. The amount and type of text can easily be changed, according to your preferences and needs.
A Good Enough addEvent
This function makes it easy to add events without tripping over existing ones. Easy to implement.
Client Window Size
Use this snippet to obtain the width and height of the visitor's client window. This is a much better method than getting the resolution as this is the actual size of the window displaying the Web page.
getElementsByClassName - The Ultimate Version
This code returns the position of a given element in a given container, relative to other elements of its type. Very useful for finding position indexes of list items, pictures, form items, and more.
When writing many types of Web applications, there is sometimes a need to let a user delete something. It is generally a good practice, however, to have the user confirm their intentions. One method of doing this is by using a snippet of code to bring up a confirmation message. This snippet can be easily added to an existing or new script or application.
Change Background Colors
Use this snippet to let your visitors change the background color of your Web page. Combined with a cookie, the setting could follow them through your whole site.
Overriding IE's getElementById()
There is a well-known bug in the Internet Explorer implementation of the
getElementById()method, which, contrary to the W3C standard, allows the method to return an element even if only the element's
nameattribute matches the requested
id. This snippet will easily correct that problem.
Add and Remove Elements
Dynamically create HTML elements with content wrapped within them according to the DOM2 specification. Easy to implement.
Determine Window Size
Use this snippet to determine the size of an open window. Can be used in many different situations, e.g., for setting the size of a div.
This snippet is a function that validates a URL. It can easily be added to your current validation script.
Keycode Checker Tool - Disable
Use this function to disable certain keys. This essentially tells the page to cancel the last event, e.g. the pressing of that certain key.
Keycode Checker Tool
Specify Referring Page
Use this script to ensure that a user can only reach a given page from another specified page. Easy to set-up and use.
Add a Hotkey
This script will fire an event when the key specified in the variable "key1" is pressed. In this example, pressing the spacebar will trigger the display of an alert box.
Find All Elements By Class
A function that returns an array of elements based on DOM element, tag, and class name. For instance, getElementsByClassName(document, 'tr', 'info') will return an array of all "tr" tags under the document node having the "info" class.
Autofill and Select Form Fields
When testing forms you don't need to keep filling in the different fields. Use this function to automatically fill-in input blocks and select values in the form for you. Very easy to use.
This snippet searches an array for a pre-specified element and returns 'true' if it's found, 'false' if it's not found. It functions like the in_array() in PHP.