English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need to create a dialog box on a web page, basically, when you click on a link, the dialog box pops up and asks if you want to continue, on clicking ok, I want it to take you to the next page, if you click cancel, it will leave you on the page you started on, Can anyone provide me with the code for this or point me to where i can get it from?

2006-08-24 04:47:22 · 5 answers · asked by jeffpattison12 2 in Computers & Internet Programming & Design

5 answers

Okay, first it is Javascript, not Java, Javascript is based on the same syntax and that's about it.

Second, this is pasted into the HEAD of the document :




And this into the thing you want clicked on :

onclick="GoAhead()"


Any problems with this? Contact me.

Good Luck.

2006-08-24 05:36:34 · answer #1 · answered by wolf 2 · 0 0

What you are looking for is the window.confirm() method. It will open a dialog box with OK and Cancel. Clicking OK returns true, Clicking returns false. A website with lots of javascript info is listed in the sources.

Here's some rough sample code:


function SomeFunction()
{
if(window.Cofirm())
{
//put OK click logic here ex: window.location.href = SOMEURL;
}
else
{
// put Cancel Logic here :ex do nothing
}
}



Hope that helps.

2006-08-24 13:22:11 · answer #2 · answered by recurs1on 1 · 0 0

y not just use a simpler scirpting program if u can't script like say Flash doh

2006-08-24 13:14:30 · answer #3 · answered by LazyForLife 2 · 0 0

http://www.w3schools.com/html/

2006-08-24 11:49:41 · answer #4 · answered by Anonymous · 0 0

no

2006-08-24 11:53:57 · answer #5 · answered by mooncalf 4 · 0 0

fedest.com, questions and answers