473,385 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Message Box. 3 Choices - How ??

Hi

I can create a messagebox that gives you Yes / No options

But I'd like to create one that gives... Yes / No / Maybe

More specifily...

Text in message box will read:

Is this chargeable ?

Yes -> goto page1.html
Cancel -> Cancel
No -> goto page2.html

Can this be done ?

Thanks

Jul 23 '05 #1
3 6378
In article <bj********************************@4ax.com>, to**@adslweb.co.uk
enlightened us with...
Hi

I can create a messagebox that gives you Yes / No options

But I'd like to create one that gives... Yes / No / Maybe

More specifily...

Text in message box will read:

Is this chargeable ?

Yes -> goto page1.html
Cancel -> Cancel
No -> goto page2.html

Can this be done ?


Not with javascript alert/confirm/prompt.
If this is for MSIE only (intranet/CD/HTA/etc), vbscript may allow it with
MsgBox. I haven't tried it, but plain VB can. Check MSDN.

If this is for the web (cross-browser), you'll have to simulate an alert-type
thing with a floating DIV with buttons that have those options and catch
onClick, or some such workaround.

--
--
~kaeli~
Experience is something you don't get until just after you
need it.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
kaeli wrote:
If this is for MSIE only (intranet/CD/HTA/etc), vbscript may allow it
with MsgBox.


From trusted applications like HTAs, WScript.Shell's Popup will work, too:

try {
var oWShell, nChoice;
oWShell = new ActiveXObject("WScript.Shell");
nChoice = oWShell.Popup(
"Press YES for page1, NO for page2, or CANCEL to cancel.",
0, "Navigate to another page", 35
);
if (nChoice == 6) {
location.href = "page1.html";
}
else if (nChoice == 7) {
loction.href = "page2.html";
}
}
catch(oError) {
if (window.bDebug > 0) {
alert(oError.message);
}
}

ciao, dhgm
Jul 23 '05 #3
Dietmar Meier wrote:
kaeli wrote:
If this is for MSIE only (intranet/CD/HTA/etc), vbscript may allow it
with MsgBox.

From trusted applications like HTAs, WScript.Shell's Popup will work, too:

[...]

To remove the IE-centricity, why not a 'pop-up' div that contains
checkboxes with the relevant items?

The example below writes the value to an input supplied by the call,
but it could just return the selected value.

<style type="text/css">
..pHead, .pTxt
{font-family: arial, sans-serif; font-weight: bold;
background-color: #333366; color: #eeeeff;
margin: 0; padding: 5px 5px 2px 2px;}
..pTxt
{font-weight: normal;}
..pDiv
{color: #333366; background-color: #eeeeff;
position: absolute; border: 1px solid #333366;}
</style>
<script type="text/javascript">
function confirm(){
var a = [];
var i = arguments.length;
while (i-- && (a[i] = arguments[i]) );
var src = a.shift(); // element call came from
var tgt = a.shift(); // element to write value to
var oD = document.createElement('div');
var oP = document.createElement('p');
oD.className = 'pDiv';
oP.className = 'pHead';
oP.appendChild(document.createTextNode(a.shift())) ;
oD.appendChild(oP);

i = a.length;
while (i--){
oI = document.createElement('input');
oI.type = 'checkbox';
oI.value = a[0];
oI.onclick = function () {confClick(this,tgt)};
oD.appendChild(oI);
oD.appendChild(document.createTextNode(a.shift())) ;
oD.appendChild(document.createElement('br'));
}
oD.style.top = tgt.offsetTop + 20 + 'px';
oD.style.left = tgt.offsetLeft + 'px';
document.body.appendChild(oD);
}

function confClick(x,tgt){
tgt.value = x.value;
var z = x.parentNode;
z.parentNode.removeChild(z);
}

</script>
<div style="position: relative; height: 100px"></div>
<form action="">
<input type="text" name="inA" value="blah" size="20"
onblur="confirm(this,this.form.confA,
'Is this chargeable?','yes','no','maybe');">
<input type="input" name="confA" size="5"><br>
<input type="reset">
</form>


--
Rob
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: nt9 | last post by:
I am very new with php so excuse me please if the question seems really easy.I have a page(form) which displays a list of the titles of some books(retreived from a database) and each title has a...
6
by: Mica Cooper | last post by:
Hi, I have a series of Select menus on a page. I am trying to allow the user to click on the Select title and have it popup a help window. This works fine with the following code except that all...
9
by: Coleen | last post by:
I'm using MS .Net Version 7, using VB .Net working on a "simple" web page. All I want to do is display a messagebox. I tried using Messagebox.Show, and get an error that Messagebox has not been...
6
by: apngss | last post by:
When an application needs to get information from another machine over the network, how many distributed computing choices out there? Here are the choices I know of, classifying by different...
1
by: John Baker | last post by:
Suppose I am exploring an unknown form programatically through VBA, and I have run across a control I have determined is a combo box. Is there a way to tell if the combo choices are restricted to...
6
by: InDeSkize | last post by:
I'm in the middle of building a database in access 2002 for a client of mine. I just wanted to know what my choices were to make this database accessable from multiple clients at once. His...
9
by: Rhino | last post by:
How hard (and desireable) would it be to give the user certain choices when it comes to printing web pages? The pages on my site use colours and pictures and contain an imbedded menu, among...
4
by: wideasleep | last post by:
Hello everyone, I am looking for a way to remove choices from cascading combo boxes as each selection is made. Here's how this is laid out. The initial combo box is STAGE and it will have...
5
by: vajra1987 | last post by:
Hello everybody I am working on a Website built on JSP and Servlets . one of the features of the site is to give user the chance to subscribe to different newsletters under different categories. ...
1
by: jej1216 | last post by:
Background: I have an PHP form that inserts data into a MySQL DB, and it works. Severity of Incident: <select name="severity" size="1"> <option value="">Select a Severity Option</option>...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.