Compute CSS Styles
17
This is a brief revision to my previous snippet. It is still what it was: a small, simple system for using XMLHttpRequest without using globals.
I'll put the API spec in the code this time, so as not to clutter the front page further.
Changes:
I'll put the API spec in the code this time, so as not to clutter the front page further.
Changes:
Changed name to HTTPRequest (far more accurate)
Added HEAD requests
Shortened code by making a GenericRequest function
Used a better method for getting an XMLHttpRequest object (checks multiple MS versions and implements the latest one)
15
This is a simple script to provide basic cross-platform XML request functionality in Javascript. It's meant to be the core component in any AJAX style framework. It is not an instantiable object, but instead is a namespaced microlibrary.
Calling is easy:
XMLRequest.GET(uri, query, callback, fallback)
uri: The location you're after
query: an associative array of form data to provide via the URL
callback: callback function of the form myCallbackFunction(objXMLHttpRequest), which is called upon successful (response = 200 OK) retrieval of the XML data
fallback: myFallbackFunction(objXMLHttpRequest), which is called upon failed (response != 200 OK) retrieval of the XML data.
XMLRequest.POST(uri, query, form, callback, fallback)
Similar, but does the query using the POST method. 'query' is the URL-appended data, still in associative array form, and 'form' is the same for the POST data.
Calling is easy:
XMLRequest.GET(uri, query, callback, fallback)
uri: The location you're after
query: an associative array of form data to provide via the URL
callback: callback function of the form myCallbackFunction(objXMLHttpRequest), which is called upon successful (response = 200 OK) retrieval of the XML data
fallback: myFallbackFunction(objXMLHttpRequest), which is called upon failed (response != 200 OK) retrieval of the XML data.
XMLRequest.POST(uri, query, form, callback, fallback)
Similar, but does the query using the POST method. 'query' is the URL-appended data, still in associative array form, and 'form' is the same for the POST data.
6
This function will set the style of an element by it's ID
6
This function sets a particular style for an element based on it's class
8
This code is used in an Educational Portal product but can be tweaked to fit your need.
This code adds a small icon next to the title of a 'portlet' that resides on the page. By clicking the portlet title, the portlet usually maximizes within the constraint of the portal template - but the extra icon allows for the portlet to be opened in it's own window.
This simulates an MDI interface.
(REQUIRES PopItUp snippet)
This code adds a small icon next to the title of a 'portlet' that resides on the page. By clicking the portlet title, the portlet usually maximizes within the constraint of the portal template - but the extra icon allows for the portlet to be opened in it's own window.
This simulates an MDI interface.
(REQUIRES PopItUp snippet)
11
I found this to be a neat little trick for hiding(somewhat) source javacscript code from peering eyes...
This function will unload all linked javascript files so that when you view source - you see no javascript files! (Especially helpful when using FF and using web-developer tools - no linked js files are displayed) The files remain resident in memory - allowing for the functions to work.
Just call the function in the tag
This function will unload all linked javascript files so that when you view source - you see no javascript files! (Especially helpful when using FF and using web-developer tools - no linked js files are displayed) The files remain resident in memory - allowing for the functions to work.
Just call the function in the tag
11
This script will allow for conditional loading of javascript libraries. The example here only has one condition to check for IE or Firefox then loads the appropriate .js file.
This is part of an .aspx template for an educational portal product.
Usage for loading the script:
This is part of an .aspx template for an educational portal product.
Usage for loading the script:
12
Allows you to hide all elements on an HTML page by their tag name. Extremely handy in getting around the "Windowless Elements" problem in IE, which is a bug that puts certain elements, most commonly select boxes, on top of any other element, no matter what. As you can imagine, this causes real problems with DHTML drop-down menus and such like. This is the simplest and quickest fix I've come up with, I simply set this function to run alongside the drop-down and all of the select tags vanish before a menu drops, then I run the show function when the menu retracts.
11
Enforce loadig fresh script code for the external javascript files. Compatible with HTTP 1.0.
6
This snippet also you to limit the input in a form field to a specified number of characters. It displays a counter so users can see how many characters they have left, and once they reach the limit the field just trims the length to your limit.
The following is a snippet from what I used when I implemented a tagboard to my site. Further revisions could/should read the LIMIT from the maxlength attribute
The following is a snippet from what I used when I implemented a tagboard to my site. Further revisions could/should read the LIMIT from the maxlength attribute









