Knebel Home
{ JavaScript }
2 Column Multi-Select Box
Allows a user to choose a(n) element(s) from a list box and move it to another and vice versa
AJAX Tutorial: Retrieving Data
This is a demonstration of how you can use AJAX to look up a zip-code entered into a form field. When the zip-code is entered, we make a call to our data using (AdamV's) Javascript / AJAX, and populate the form without refreshing the page!...
Alert your user!
Here's a quick way to let your user know something when they press a button... <BR>
Capture Right-Mouse Clicks
Not sure where I grabbed this from, but it can be used to capture the right-click event from a browser.
Cascading Menu (Javascript and iFrames)
Use the following code to create a cascading menu. Note, this method uses a separate page for each menu "iframe_src.html" and "iframe_src2.html".
Cascading Menu (Source Pages)
When you use the code from the "Cascading Menu" link in this section, you use 2 source pages for the menus. The code below is an example of those source pages. <BR>
Change Textarea size dynamically
This example shows you how to resize a textarea dynamically. Useful when someone is editing long text, but you wish to display in a compact fashion until the user needs more typing space.
Check/Uncheck Checkboxes using buttons and/or links
Copy this code into a page and load it. This example shows you how to check / uncheck checkboxes using Javascript. The example is field-name independent (you pass in the form id attribute instead), so it's friendly to anything you want to...
Click here to go "back" (simple javascript link)
Paste this as a link with and you´re done! This "link" takes your user to the previous (1) document in their history.
Confirm a User Input
Use this script to confirm a user's input. It seems that in PHP, the 'alert' portion assists in exectuion of the remainder of the 'if' statement.?.?
Disable Submit Button
This is a simple form which, on the onClick event for the button, will disable the button on a form.
Dynamic Combo-Boxes
Want to fill a combo box with new values when the user clicks on one of your other combo boxes? Here's how - just paste this code into a new html page.
Fire an event on combo change
Here's a simple script to change the page you're on, simply by selecting an option in a combo box.
Form Validation
Here's a quick example of how you can loop through all fields in a form, and see ensure they have a value. Paste the code below into a new page.
HTTPFetch
Use this script to fetch a file. Courtesy of: http://www.liquidcoolresearch.com/asp/ NOTE: You will need to get the Java Class (FREE): http://www.liquidcoolresearch.com/asp/HTTPFetch.class
Javascript Date Functions
Useful Javascript date functions
Javascript Object Inheritance
Use the following methods to create an instance of a class, then have that class inherit another function using prototype constants.
Javascript Regular Expression Routine
This is a javascript function that currently will check for US Phone numbers ((###)-###-####), valid email addresses (123@123.com), and valid dates (mm/dd/yyyy). It accepts two parameters, 1) the obj context in question, 2) the id of the validation ...
Loan Calculator
paste the following into a new page
Multiple Select Box - Retrieving items
Use the following function to loop through items in a multiple select box - selected or not.  Useful when using select boxes to add / remove items.
OnMouseOver Event - Exchange a picture...
Use this to highlight an image when the user hovers over it:
Referenece Fields dynamically by name
The following shows how you can dynamically reference a field in a form, by that field's name:
Reload parent document from within an iFrame
Place the following code in your iFrame, then when fired, it will reload the parent page containing the iframe.
Replace text on the fly
This example includes both an onMouseOut event, and a non-onMouseOver event. This way you can display text either "permanently", or until mouse is moved away from the link. <BR> <BR>
Running Clock Display
Use this code to create a running clock. Using a DIV or any other HTML object that allows you to set the innerHTML: Invoke the clock function from a BODY onload event. <BODY Onload="clock()"> <div id ="dispClock"></div> </BO...
Set Font-Weight or Font-Color (attributes with dashes)
Create a form as follows:  the example below will change the button color when a user types or presses a key.
Setting the Visibility (Style) Property
You can use the visibility property to show or hide an object:
Simple DOM Forward Script
This simple DOM forwarding script will replace the current page with whatever you tell it (like this site :-).
Using Focus() and Select() methods
This code snipplet is a quick example of setting focus to a particular textbox. Cut and paste the following code into a new page.