We accept safe and secure Credit Card and PayPal Payments.
Perl Scripts

All Count
Attachment Mailer
Perl Scripts Build A FAQ Plus
Perl Scripts Clock In Center
eBackup Automated
Easy Poll
Fetch a File
Form Maker
Mailing List Server
MySQL Mate
PDF Creation
Quick Fix
Quote of the day
Speed Search
Task Manager
Traffic Pack
Upload Plus
Upload Gold
Upload Pro
Website Manager

Free Perl Downloads

Free Perl Scripts Main Page
Free Perl Scripts 404 Alerter
AccessLog Viewer
Build A FAQ
PHP Scripts eBackup
Free PHP Scripts ErrorLog Viewer
eVars - Server Info
HT Pass Creator
Upload Lite
Website Manager


Free Java Scripts Alert Boxes
Free JavaScripts Browser Sniffer
Check email
Slide Show
Window Maker

Extra Utilities

ASP Scripts Ascii Codes
Free ASP Scripts Color Picker
Font Finder
HT Pass Creator
Meta Cloak
Meta Magic
Pano Zooms
Server Size

Online Tutorials

Free HTML Scripts Glossary
Free HTML Scripts HTML
Build Traffic


About Us
Latest versions

Hawk Eye in Tennis

Should Hawk Eye replace linesmen and lineswomen at all tennis tournaments?

View all Polls

Run Polls on your site

Run your own Surveys

Store Download FAQs Contact Us Support Programming Policies  
JavaScripts :: Miscellaneous :: Alerts, Confirms and Prompts

Using Microsoft's propriety VBScript, you have a little more control of prompts and alerts. Below are some examples showing you how to add your own title to the popups. Note that VBScript is only supported by Internet Explorer. Netscape will show a regular alert, confirm or prompt. IE5 means IE5+ so IE6 will also be taken into account.

Note also that when using JavaScript and VBScript on the same page you must define a value in the language attribute. Eg.

<script language="VBScript">


<script language="JavaScript">

This rule is waived if the VBScript is last script tag on your page.

The Script

// Browser sniffer. Written by PerlScriptsJavaScripts.com

v3 = 0; op = 0; ie4  = 0; ie5 = 0; nn4 = 0; nn6 = 0; isMac = 0;

    if(navigator.userAgent.indexOf("Opera") != -1){
        op = 1;
    } else {
        ie4 = (document.all && !document.getElementById);
        nn4 = (document.layers);
        ie5 = (document.all && document.getElementById);
        nn6 = (document.addEventListener);
} else {
    v3 = 1;    

if(navigator.userAgent.indexOf("Mac") != -1){
    isMac = 1;

// start the actual code for an alert

function alert_confirm(){
    if(ie4 || ie5){
        // if its IE4+ call the VB Script 
        retVal = makeMsgBox("Hi","how are you?",32,1,256,4096);
        // which button was pressed?
        if(retVal == 1)            {alert("Ok pressed");}
        else if (retVal == 2)      {alert("Canceled");}
    } else {
        // else use a simple alert
        alert("I am not IE");

// start the code for a prompt

function input_box(){
    // only three args here
    // Title, Question, Default answer
    if(ie4 || ie5){
        retVal = makeInputBox("Hi","How are you?","Fine, thanks");
    } else {
        retVal = prompt("How are you?","Fine, thanks");
    } else {
// -->

This is the VB SCript called by the code above if IE is detected.

<script language="VBScript">
Function makeMsgBox(tit,mess,icon,buts,defs,mode)
   butVal = icon + buts + defs + mode
   makeMsgBox = MsgBox(mess,butVal,tit)
End Function

Function makeInputBox(title,question,default_answer)
   makeInputBox = InputBox(title,question,default_answer)
End Function
// -->
Internet Explorer will call the VB Script while Netscape will execute the JavaScript. Below is a list of arguments each function takes. For example, if you look at the script above, you will find this line of code :

retVal = makeMsgBox("Hi","how are you?",32,1,256,4096);

You can change the numbers to create alerts, confirms or any type of popup using the numbers / arguments below.

The alert and confirm boxes take 4 arguments

Argument one : The Icon         0  = none
                                16 = X 
                                32 = ? 
                                48 = ! 
                                64 = i 

Argument two : The buttons      0 = OK   # standard alert
                                1 = OK CANCEL
                                2 = ABORT RETRY IGNORE
                                3 = YES NO CANCEL
                                4 = YES NO
                                5 = RETRY CANCEL 

Argument three :                0    = First
In your popup, which            256  = Second
button should be selected       512  = Thrid
by default?

Argument four :                 0    = Browser stalls
The system command will         4096 = All apps stall
stall either the browser 
or the whole system until 
the user responds 
(either submits or cancels)

A value is returned 
depending on which button 
was pressed. So you could say 

if(retVal == 3){do this} 
else {do this}

Here are the return values      OK      = 1 
                                Cancel 	= 2 
                                Abort 	= 3 
                                Retry 	= 4 
                                Ignore 	= 5 
                                Yes     = 6 
                                No      = 7 

Alert or Confirm box

Input box
Speed Search our site
Linux Hosting Plans from $9.12 per month, includes Plesk Control Panel, MySQL databases, cgi-bin, crontab manager and 50 email accounts.

Plesk Hosting
Linux servers with Plesk Control Panel, cgi-bin, crontab manager, Mysql, PHP and ASP.

Discounted Scripts
Subscribe to our periodial newsletter to receive special offers.

Bathroom Hygiene
How often do you thoroughly clean your bathroom?

View all Polls

Run Polls just like this one on your website!

About us | Contact us | Script FAQs | Script Support | Website Hosting | Our Policies | Store | Testimonials
Subscribers log in here. Subscribe to our periodical newsletter for special offers on commercial scripts, hosting, exciting business opportunities, and industry news and events. Our Mailing List Software is powered by Consolidator    
HTML Plain text
©1999 - 2015 All content Copyright PerlScriptsJavaScripts.com Proudly hosted by LinuxHostingPlans.com