Jump to content
Sign in to follow this  
shah_ankitb

Can I Add one or more Buttons?

Recommended Posts

Hello Everyone, as u all know we all are Using Confirm box when it alert's it display 'OK' or 'Cancel' / 'Yes' or 'No'.I would like to ADD one or more button in the Confirm box. I don't know how to do.I want Three Button's say 'Yes' , 'No', 'Cancel'.Can anybody help me with code if possible.

Share this post


Link to post
Share on other sites

No, sorry. You'd need a custom confirm/prompt box made with HTML & JS. :)

Share this post


Link to post
Share on other sites
No, sorry. You'd need a custom confirm/prompt box made with HTML & JS. :)
Or use VB script and force your users to use IE on Windows machines. :)

Share this post


Link to post
Share on other sites

Thanxs for Reply, As per i know Confirm Box returns BOOL means true / false. If any body has a idea how to add one or more buttons named like 'First','Second','Third', etc. I am going to use this Java Script in PHP.Ur Answer will be appreciated.

Share this post


Link to post
Share on other sites

here is an example of a custom confirmation box I got from another forum

<html><head><title>Custom ConFirm, Alert and Prompt</title><style>/* You can modify these styles to anything you want (or is allowed). *//* These are used by both browsers. You can set these to your preferences. */.td1style {font-weight:bold;border:1px solid black;background-color:lightgrey;color:blue;font-size:14px;fontFamily:Verdana;}.td2style {font-weight:bold;border:1px solid black;background-color:lightyellow;font-size:12px;font-family:Verdana;}/* the style below is for the links that are inside the div when it pops up */.linkstyle {font-weight:bold;font-size:12px;text-decoration:none}</style><script language="JavaScript">var msgtop=50 // Set the top position of the divvar msgleft=20 // Set the left position of the div/* The following three variables are for setting the properties of your table contained within the div. */var tborder="0"var cspace="0"var cpad="0"var tabheight=50 // Set the height of tablevar tabwidth=150 // Set the width of tablevar td1height=10var td2height=30var boxt=""function Domsg(flag){hidebox() // Hide the box after clicking on text link in boxif(flag=="Yes"){msg="You Clicked "+flag+"!"}else{msg="Why did you click "+flag+"?"}document.formbx.result.value=msg}function DoFormbox(msgtext){theString="<table width='"+tabwidth+"' height='"+tabheight+"' border="+tborder+" cellspacing="+cspace+" cellpadding="+cpad+"><tr><td height='"+td1height+"' class='td1style' align='left'><b>"theString+=""+msgtext+"</b></td></tr><tr><td height='"+td2height+"' align='center' class='td2style'><a href='java script:Domsg(\"Yes\")' class='linkstyle'>Yes</a>   <a href='java script:Domsg(\"No\")' class='linkstyle'>No</a></td></tr></table>"if (document.layers) // Netscape 4.0+{document.formbox.document.write(theString)document.formbox.document.close()document.formbox.left=msgleftdocument.formbox.top=msgtop+40document.formbox.visibility="show"}else{if(document.getElementById) // Internet Explorer 5.0+ and Netscape 6.0+{elm=document.getElementById("formbox")elm.innerHTML=theStringelm.style.top=msgtopelm.style.left=msgleftelm.style.visibility = "visible"}}}// This function is for hiding the divfunction hidebox(){if (document.layers) // Netscape 4.0+{document.formbox.visibility="hidden"}if(document.getElementById) // Netscape 6.0+ and Internet Explorer 5.0+{elm.style.visibility="hidden"}}</script></head><body><div id="formbox" style="position:absolute;visibility:hidden;left:0;top:0;"></div><center><h1>Custom Confirm</h1><form name="formbx"><input type="text" name="result" size="30"></form><a href="java script:DoFormbox('Are you sure?')">Click Me for a Confirm Box</a><br></center></body></html>

Share this post


Link to post
Share on other sites

Thanks aspnetguy for scipt, But script dosen't work properly, when i add data in Text Box & Click On the Link it will take me to the Blank Page. I am Using IE 6.0+, but still no Outputs.I have save file with .html extension.Waiting for ur w/o error Script.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...