To prevent any frustration, it's recommend to read the full documentation before start using iv_popup.
Sometimes it would be very useful, if the confirm() method had some more options.
Thats why I wrote this algorithm.
You can define as many buttons as you need and you also can just use the standard confirm() method if you want.
iv_confirm - A multi confirm checkback
Copyright (C) 2007 Ingo Volkmann
Visit my site and get in contact with me at godiv.de
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
The installation is very simple.
Copy the iv_confirm.js file to your webserver.
Don't forget to adjust the 'src' attribute if the iv_confirm.js file is not located in the same directory as your page.
all functions are prefixed by iv_ to prevent any collisions with your own scripts
standard confirm() method:
- you just need to define the first parameter, the displayed text
- leave the other parameters blank or set them to 'false'
- returns 'true' or 'false'
- you need to define the first and second parameter - the displayed text and an array with the button information
- button information must be in an array in pairs of two - button value and function name which should be called if the button is clicked
- the array pieces are expected as strings and each button needs an own array
- put all button arrays into one all embracing array - this will be the second parameter
- the third parameter is needed, if the confirm window is to small - min width is 300px
- returns nothing
var iv_str = 'Choose an option!';
var iv_width = 400;
var iv_btn1arr = new Array('Button 1', 'button1clicked');
var iv_btn2arr = new Array('Button 2', 'button2clicked');
var iv_btn3arr = new Array('Button 3', 'button3clicked');
var iv_btn4arr = new Array('Button 4', 'button4clicked');
var iv_btnArr = new Array(iv_btn1arr, iv_btn2arr, iv_btn3arr, iv_btn4arr);
standard confirm() method (returns true or false):
var check = iv_confirm(iv_str);
modified version (returns nothing, will call the given functions):
iv_confirm(iv_str, iv_btnArr, iv_width);
- nothing at present