joecooper Posted March 28, 2006 Share Posted March 28, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/6025-dialog-box/ Share on other sites More sharing options...
trq Posted March 28, 2006 Share Posted March 28, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/6025-dialog-box/#findComment-21655 Share on other sites More sharing options...
joecooper Posted March 28, 2006 Author Share Posted March 28, 2006 Thanksdoes anyone have a working version of this? Quote Link to comment https://forums.phpfreaks.com/topic/6025-dialog-box/#findComment-21660 Share on other sites More sharing options...
redbullmarky Posted March 28, 2006 Share Posted March 28, 2006 [!--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--]Thanksdoes 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 phphope it helps thoMark Quote Link to comment https://forums.phpfreaks.com/topic/6025-dialog-box/#findComment-21677 Share on other sites More sharing options...
joecooper Posted March 28, 2006 Author Share Posted March 28, 2006 thanks, but also doesnt work. Quote Link to comment https://forums.phpfreaks.com/topic/6025-dialog-box/#findComment-21695 Share on other sites More sharing options...
redbullmarky Posted March 28, 2006 Share Posted March 28, 2006 (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. Quote Link to comment https://forums.phpfreaks.com/topic/6025-dialog-box/#findComment-21707 Share on other sites More sharing options...
ober Posted March 28, 2006 Share Posted March 28, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/6025-dialog-box/#findComment-21717 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.