| View previous topic :: View next topic |
| Author |
Message |
samiel
Joined: 04 Jul 2008 Posts: 2
|
Posted: Fri Jul 04, 2008 11:25 am Post subject: how can I customize confirmation box? |
|
|
Are there any ways to set the title of a confirmation box and set the "cancel" button defaultly selected?
Thx ! |
|
| Back to top |
|
 |
|
|
rangana 500+ Club

Joined: 27 Feb 2008 Posts: 629 Location: Cebu City Philippines
|
Posted: Fri Jul 04, 2008 2:30 pm Post subject: Re: how can I customize confirmation box? |
|
|
In a nutshell, you cannot.
But there are a lot of ways that you can achieve what you wish.
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/dhtmlmodal.htm
..or this code:
| Code: |
<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 div
var 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 table
var tabwidth=150 // Set the width of table
var td1height=10
var td2height=30
var boxt=""
function Domsg(flag)
{
hidebox() // Hide the box after clicking on text link in box
if(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='Domsg(\"Yes\")' class='linkstyle'>Yes</a>   <a href='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=msgleft
document.formbox.top=msgtop+40
document.formbox.visibility="show"
}
else
{
if(document.getElementById) // Internet Explorer 5.0+ and Netscape 6.0+
{
elm=document.getElementById("formbox")
elm.innerHTML=theString
elm.style.top=msgtop
elm.style.left=msgleft
elm.style.visibility = "visible"
}
}
}
// This function is for hiding the div
function 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="javascript:DoFormbox('Are you sure?')">Click Me for a Confirm Box</a><br>
</center>
</body>
</html>
|
Edited from this post
Hope it keeps you going  |
|
| Back to top |
|
 |
samiel
Joined: 04 Jul 2008 Posts: 2
|
Posted: Fri Jul 04, 2008 5:16 pm Post subject: Re: how can I customize confirmation box? |
|
|
| thx a lot, I will try that out |
|
| Back to top |
|
 |
rangana 500+ Club

Joined: 27 Feb 2008 Posts: 629 Location: Cebu City Philippines
|
Posted: Sat Jul 05, 2008 3:03 am Post subject: Re: how can I customize confirmation box? |
|
|
No problem. Glad I could help  |
|
| Back to top |
|
 |
|