473,385 Members | 1,944 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.

custom alert box that pauses program until button is pressed

I have written a program in javascript and it works as I want it too. However it uses the "alert" command at various points. I wanted to make a custom alert so I googled that and all the result make nice looking alert boxes, however there is a fatal problem when I use them rather than the normal javascript "alert" command. The custom alerts never stop the program at that point until the user shuts it down by clicking on the "ok" button. My current code can be seen at -

http://www.shogiwar.webs.com/Gunnm_Paraphernalia/Chinchirorin.html

(click on "view source" in your browser to see the code). click on the "roll dice" for the alert buttons to appear. (you'll see in my code I've commented out the custom alert stuff).

How do I create a custom alert box that also stops the program at that point until the user clicks the "ok" button (or whatever button I create in my custom alert box)?

thanks in advance,
Dec 8 '10 #1
4 3492
acoder
16,027 Expert Mod 8TB
Put an overlay over the whole page, e.g. see this example.
Dec 8 '10 #2
Sorry I obviously wasn't clear about what the problem is. I tried the code in this link but it doesn't work, that is, it doesn't solve my problem. This link seems to be dealing with the issue of people clicking on other parts of the screen while the alert box is showing. This is not my problem. consider the following code -
Expand|Select|Wrap|Line Numbers
  1.   for (i=0; i<4; i++)
  2.   {
  3.     alert("i="+i);
  4.   }
  5.  
in using a "normal" alert then each iteration though this loop there will be an alert box appearing with the text "i=0", "i=1" etc. However if I use the modified alert box then there will not be an alert box for each iteration of the loop. Only one alert box will appear with the text "i=4". How do I get the custom alert box to stop the program from continuing so that each iteration of the loop will work?
Dec 9 '10 #3
acoder
16,027 Expert Mod 8TB
Ah, I see. You're going to have to program this functionality in yourself. So, when calling a custom alert, change it to call the next line on clicking OK.

I've never done this myself, so I'll just explain the theory and hopefully it should work in practice, but I've not tested. In the case of your for example, you could perhaps change the code to gather the expected alert outputs and then pass the next one to the alert function to execute once the current one is "complete", i.e. when the user clicks OK.

Hope that makes sense. This is probably just one way you could solve it.
Dec 10 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: L-and-F | last post by:
www.lee-mcgeorge.co.uk I've been using custom Alert boxes for a long time in various guises. The way I've shown below is perhaps the easiest. There are more efficient and cleaner ways to do it,...
7
by: M | last post by:
i have a form which i would like to input different "action" url depending on the button that was clicked. is there a way that javascript can prefill a defined action based on the button...
1
by: John Michael | last post by:
Is it possible to detect when someone has pushed their Esc button on a form. When a form is open and someone is adding a record, if they push the esc button, the whole form gets reset to an empty...
3
by: Mel | last post by:
Hi, Is there any way I can force to change button background colour when toggle button is checked? Just like button change its background colour when mouseover in MS Visual Studio.NET. I hope I...
1
by: Ed Sutton | last post by:
<Newbie> How can I get arguments, and build a query URL, before a button is pressed? I have a text box to enter a serial number. When the search button is pressed, I wish append the serial...
0
by: Grayzag | last post by:
Hi there, As part of my Software course, i have to create a game. Since I originally started out with python, I was used to it being really easy to create a main loop to control the game with a...
1
by: thewickedman | last post by:
Hi, I try to open new OpenOffice document (writer), But I am getting the exception FRM 40735:WHEN-BUTTON-PRESSED Trigger Raised unhandled Exception ORA - 305500 Please help me to resolve...
2
by: IISPro | last post by:
I'm building a simple ASP.NET Windows application One the Windows Form there is a Button. If you click on it it calls a subroutine What I want to do is the Sub routine once it complete start...
2
by: thesti | last post by:
hi, this might be a programming logic problem the scenario is, i have a label with imageIcon and two buttons, A and B. the label (with imageIcon) is representing the value of a randomed...
8
by: jodleren | last post by:
Hi It is late and I am tired. I cannot remember how to check which of my buttons on the form was pressed. There are all submit's. Like echo "P=".$_POST; // and eventually using isset() ...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.