This area is for useful scripts that some of our visitors have
contributed. ASP 101 did not write them and is not responsible for the
operation of these scripts... heck we don't even take responsibility
for our own. ;) We simply found them interesting and or useful and
thought some of you might too!
"In creating my new site,
I have come up with a piece of code which I call Universal SQL Insert
String. Basically, it is an include page which will automatically create a
variable (cmndINSET) which is a correctly formatted insert string for
Access databases based on the submitted form fields. It is to be used
within the asp results page that proceses the form and inserts the forms
responses into the database.
I have set up the code so that the table and any form fields you want
excluded from the database are defined on the results page."
Here's a fun little script that will print out every possible word
that your phone number might spell. While I didn't get anything as
cool as GoFedEx or PickUPS, I did find out that my number spells
the gems JUXXEMS, KTYYENS, and LUXYDOS.
First I just wanted to let you know I have been learning from your (and 4Guys) website for the past 2 years!
I truly have built 98% of my site from your contributions!
Now it is my chance to give something back to you and your readers.
I have been looking for a script that will auto-pull the status from the DHS website and display the
appropriate image on my site but couldn't find one. True, SoftShell has a DLL that can do it...
but I didn't want to install any unnecessary files. And there are some CGI and PHP Blocks out
there but no straight-up 'Ol ASP that would do it.
So I tracked down that HTTP request from ASP 101 and combined it with a Regular Expression script
from 4Guys and Woo Hoo! we have real-time checking.
Again, thank you for your site and its content... especially the samples and lessons!"
M. Shawn McGrady
Webmaster's Note: There are a couple of things that I feel I should mention.
As with any HTTP requesting script... it would be a good idea to add some form of caching.
HTTP requests can be very slow and can have a significant negative impact on the performance
of your site. Caching helps speed up your page loads and as an added benefit helps alleviate
the load on the server providing the data feed. So... do yourself and everyone
else a favor and please cache! It's really pretty easy to do. If you find yourself having
problems check out my article
A Simple Method for Caching HTTP Requests.
Next... I've included two sets of images... the first came with the script. I'm not sure of
their origin. The second is the set that the DHS's site is currently using. Use them both at
your own risk.
"This is a simple form for collecting name and address information. What is unique about it
is how it deals with required fields, and how it formats those fields if the user leaves a
required field blank. If a field is left blank, the page automatically goes to the form element
that is missing, and alerts the user.
The form is valid XHTML Strict and uses CSS to position the elements, instead of tables. It
also has tool tips for the input elements.
There is also a rudimentary email verification check, and messages to the user indicating
what is wrong.
I have commented both the ASP and the CSS/HTML. The form formats and works well in
modern browsers, including IE, and is usable in NS4, but has issues."
One of our visitors sent us an alternate method of dealing
with linked dropdown lists that pull their data from a
database. His solution uses ASP-generated, client-side
fill the second list.
This file contains Multi Dropdowns solution from Database.
As you select one value from the first dropdown the other
dropdown will show the corresponding values of first dropdown."
I'm not sure why you'd want to do this, but here's a script
that will enable your web server to speak to you. That's
assuming it has a sound card and speakers...
This file conatins a sample use of Microsoft Speech Application Programming
Interface (SAPI 5.1) in ASP pages. It's a pleasure to submit this code for
others to use. I hope your users like this one.
This program will generate the simpler Code39 (or Code 3-for-9) barcodes.
You'll find these barcodes on staff and student ID badges, video rental
cards and so on.
Code39 works with alternating bands of black and white. Each character
is represented by 7 bands. The band is either wide or narrow. Inbetween
each character there is a band of white the same width as the narrow band.
Height and Width are defined by the variables numWidth and numHeight,
allowing you to customize as needed.
The code could probably be optimized and cleaned up; this was just a quick
program to solve a need we had here. If you find the code useful, I'd
love to hear from you."
"After being asked by numerous clients to allow the internet / intranet.... user to printout the content of a webpage, I trawled the internet to try and find a suitable printing / document creator. But because pdf's are too expensive / fiddly etc to create, I came up with the attached routine which creates a word file on the fly.
Create the word document that you want to print
Export the file to an rtf
Run the routine that replaces the contents with the correct FSO commands (replace.asp)
Paste the code into the 'word\build\create.asp' or navigate to the index.asp after you have unzipped the files.
The routine does not open the word file on the server, so there seems to be no major server load. Plus no COM objects to download!!!"
Here at ASP 101, we're not really known for our ability to
create stunning graphics (otherwise we'd have named the site
Graphics 101). That said, some of our users are pretty
decent at making things look pretty. This cool looking
guestbook is one such example.
"Here's a VBScript version of the classic virgenere encryption routine found
it quite a bit, without losing the essence of what it does.
I believe the script is self-explanatory. I have used it to encrypt/decrypt
sensitive data in my databases.