Jump to content

Archived

This topic is now archived and is closed to further replies.

joecooper

Dialog Box

Recommended Posts

How can i add a dialog box via a link. Pressing Yes will goto another page - and no will just close the box and not do anything?

Share this post


Link to post
Share on other sites
This is a javascript question really but... something like...
[code]
<script language="JavaScript">
<!--
function ask() {
  in = confirm("Are you sure?");
  if (in == true) {
    window.location="http://redirect.php";
  }
}
-->
</script>

<a href="#" onclick='ask()'>click</a>
[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=359362:date=Mar 28 2006, 06:41 PM:name=joecooper)--][div class=\'quotetop\']QUOTE(joecooper @ Mar 28 2006, 06:41 PM) [snapback]359362[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Thanks

does anyone have a working version of this?
[/quote]

Hi

i have this implemented in a different way attached to a form button, but it will work with links (<a>), etc too:

[code]
<input name="Submit" type="submit" value="Delete" onClick="return confirm('Are you sure you want to delete this record?');" />

[/code]

but thorpe's right, this is more of a javascript thing not php

hope it helps tho
Mark

Share this post


Link to post
Share on other sites
(mods - apologies for bumping a thread in a php forum that should be in JS)

joecooper, the code I provide and also what thorpe provided does work, but how you use it might be the problem. answer me this - what did you try the 'onclick' method on? an <a href .... > link or a button?

please can you post the code that you tried.

Share this post


Link to post
Share on other sites
To all concerned: this is a Javascript question. I have moved it here because of that. I have also renamed the thread because that's a ridiculous title and provides no meaning. joecooper, you're being warned.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.