Scripts

Download scripting code examples

For your convenience, Scriptbuzz provides some common examples of tasks that you may perform with different scripting languages. Each scripting example is written to minimize any editing on your part. So all you have to do to use the code is call a function or functions with correct parameters shown in the examples. The output of each coding example is also shown so you know for sure what the code does. Also, each major step in the code is heavily commented to help you understand.

Scripts for JavaScript

Browser functions

Display browser information

This example shows how to gather information about a user's browser.

Browser based redirect

this script redirects a browser to a specific desired page based on the browser's version number.

Detect platform

is it Windows, Macintosh or some other platform used to access the web page? Find out with this script.

Date and time functions

Hour based greeting

this is a simple script that prints a greeting message based on the hour of the day.

Get current month name

this scripting function returns the current name of the month (e.g., January, February, or March etc.).

Get current day

this script shows how to get the current name of the day (e.g., Sunday, Monday, or Tuesday etc.) of the week.

Time-related functions

this script includes number of functions that shows how to get specific time-related values: year, month, day of the month, day of the week, hour of the day, minutes, and seconds.

Digital clock

shows a simple script that can display a digital clock.

Seconds passed since last refresh

this code shows how to use a counter variable to determine when a web page was last refreshed. The code uses the JavaScript setTimeout () method to update the counter variable every second.

ASP Scripts

Generate a random number

this code shows how to generate a random number in ASP in the range 1 through 6 inclusive.

Generate random password

With this script, you can generate a random password of a random length between 6 and 10.

Send value from one ASP page to another

The script shows you how to use querysting to find out which link the user clicked on.

Determine clicked link

this script script determines determine which link the user clicks on.

Loop through an array

This ASP scripting code allows you to display the content of an array. In addition, the script shows how to get the lowest and upper boundaries of an array.

Count number of words in a string

With this scripting code, you can count how many words a particular string has.