Click to See Complete Forum and Search --> : How do I create a Yes/no message box?


Pzz--Daniella
12-24-2006, 03:53 AM
I'm all googled out, but mainly because I don't really know what the official term is for one of those boxes.

The idea is that they see a:

Please note: Simply click on it to reveal the answer.

When they do, I would like them to get one of those warning, yes/no type Microsoft Explorer thingy-type boxes (see why I'm Googled out now?) with the yellow triangle and an exclamation mark in it, that says "Are you sure you want to reveal the answer?" With the option to click on "yes" or "no". Just in case they hit it by accident.

I would really appreciate some help with this.

Pzz

aussie girl
12-24-2006, 04:50 AM
are you thinking of the JavaScript alert() function?

Pzz--Daniella
12-24-2006, 05:05 AM
This one...... (http://farm.tucows.com/2005/03/annoying_confirmation_dialog.gif)

Pzz

aussie girl
12-24-2006, 05:20 AM
this one..
http://www.javascript-page.com/confirm.html

Pzz--Daniella
12-24-2006, 05:57 AM
That's Brilliant Aussie girl.

I don't seem to be able to change the 'Ok' to a 'yes' and the 'Cancel' to 'No' though......

Would the end of the url just need to be changed to display the yes/no box code? If so, what to?

I'm really grateful for your time on this though. Thank you.

Pzz<confused>

Charles
12-24-2006, 06:01 AM
this one..
http://www.javascript-page.com/confirm.htmlDon't use that one and certainly don't include that attempt at a copyright. Use instead <script type="text/javascript">
confirm ('Are you sure you want to reveal the answer?')
</script>But what you really want is something more like <a href="the-answer.php" onclick="return confirm ('Are you sure you want to reveal the answer?')">The Answer</a>Just remember and remember well. This, like all JavaScript will fail for one in ten or twenty so don't use it for anything important.

Pzz--Daniella
12-24-2006, 06:14 AM
I keep cancelling out though as I can't seem to put the code in exactly the right place. This is what I have currently, without the code for the confirmation box inserted:

<script language="JavaScript">
<!--

function SymError()
{
return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
return (new Object());
}

window.open = SymWinOpen;

//-->
</script>

<script>

//Popup Window Script
//By JavaScript Kit (http://javascriptkit.com)
//JavaScript tutorials and over 400+ free scripts

function openpopup(){
var popurl="desk3.jpg"
winpops=window.open(popurl,"","width=900,height=700,scrollbars,resizable,")
}

</script>

<a href="javascript:openpopup()">Reveal Answer</a></font></td>

It needs to go: Click on "reveal answer" > "Are you sure" Pop-up. Yes goes to to desk.jpg pop-up and no cancels everything and stays on the same page. (Sorry if I'm stating the obvious)

I can't work out why it doesn't matter where I seem to insert your text, I cannot get the box to intervene. It still goes straight to the desk.jpg pop-up.

I have actually got it to work on one of the other pages, no problem! :confused:

Thanks for your help on this Charles.

aussie girl
12-24-2006, 08:28 AM
If you going to use JavaScript try

<script language="Javascript" type="text/javascript">
<!-- Hide script from old browsers

function newWindow()
{
if (confirm("Are you sure you want to do that?"))
{
ansWindow = window.open("zen.gif", "catWin", width=330,height=250");
}
else
{
alert("I'm not telling")
}

}
// End hiding script from old browsers -->
</script>
<a href="javascript:newWindow()">Reveal Answer</a>

Pzz--Daniella
12-24-2006, 08:40 AM
Thanks again Aussie girl, but I think it's where I'm putting the code that's the problem now, as opposed to the code itself. :-(

When I inserted your code everything looked the same, but when I clicked on the Reveal Answer link, nothing happened at all, not even the original pop-up window to desk3.jpg.

I'll get there in the end.

Thanks for your help.