Hi,
I want to applying the styles for confirm box. For this purpose i have used below code.
Here i am writting my code -
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-
<head>
-
<title>untitled</title>
-
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
-
<script type="text/javascript">
-
function doConfirm(v)
-
{
-
var b = document.getElementById('btn');
-
b.value = 'Display dialog [last return value: ' + v + '/' + (v ? 'OK' : 'Cancel') + ']';
-
}
-
-
function setDisp(id, disp, some)
-
{
-
document.getElementById(id).style.display = disp;
-
return some;
-
}
-
</script>
-
<style type="text/css">
-
#confirm {
-
position: absolute;
-
top: 40px;
-
left: 70px;
-
border: outset #000 10px;
-
padding: 1em 3em;
-
display: none;
-
background: #a5c4cc;
-
}
-
-
#ok {
-
background: #a5cca8;
-
}
-
-
#cancel {
-
background: #d6a4a4;
-
}
-
-
#ok, #cancel {
-
padding: 2px;
-
margin:2px;
-
}
-
</style>
-
</head>
-
<body>
-
<div id="confirm">
-
<div><strong>Are</strong> <em>you</em> <span style="text-decoration: underline;">sure</span>?</div>
-
<input type="button" id="ok" value="OK" onClick="setDisp('confirm', 'none','yes');" />
-
<input type="button" id="cancel" value="Cancel" onClick="setDisp('confirm', 'none','no');" />
-
</div>
-
<input type="button" id="btn" value="Display dialog" onClick="setDisp('confirm', 'block','');" />
-
</body>
-
</html>
-
-
In above code i have to set return value to the function setDisp() as true/false when click on ok ,cancel buttons. That means when i used the function setDisp() directly then it displayed the pop up window consists the ok,Cancel buttons.When i click on ok this function setDisp() returns true and when click on cancel this function setDisp() returns false. That is my requirement .Any body could you please help me how can get the Requirement.
Thanks
Swetha
3 3127
try something like this in your javascript code -
function setDisp(id, disp, some)
-
{
-
-
document.getElementById(id).style.display = disp;
-
if(some != '')
-
{
-
doConfirm(some);
-
}
-
return some;
-
-
}
-
Hi,
I tried like this .But i am not getting. please advice me.
Thanks
Sravani
hi,
just make a little change in doConfirm function then try it out. It works fine in both IE and FF. - function doConfirm(v)
-
{
-
var b = document.getElementById('btn');
-
(v == 'yes') ? z = 'OK' : z = 'Cancel';
-
b.value = 'Display dialog [last return value: ' + v + '/' + (z) + ']';
-
}
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Muhammad Abdullah |
last post by:
Hi
am having some problems with the javascript confirm.
i have it working fine on one page and it doesnt even pop up at the
other.
The code on the working page is,
private void...
|
by: Grey |
last post by:
how to design confirm message box, like Javascript Confirm box, in ASP.NET??
if the user click "YES" in the confirm box, i need to do something, else do
other things. Do I need to have javascript...
|
by: Chris |
last post by:
I can create Javascript confirm message boxes during page creation, etc
adding them to the button attributes (many good posts on this!). But how can
I add this event after the button is pressed?
I...
|
by: Tarun Upadhyaya |
last post by:
Hi,
I am facing strange problem
I read Scott mitchell's article about ASP.NET and javascript at
...
|
by: comshiva |
last post by:
Hi all,
I have converted my existing ASP.NET project from 1.1 to 2.0 and i have
found that everything works fine except the linkbutton control in my
datagrid which throws an javascript error when...
|
by: thebison |
last post by:
Hi all,
I hope someone can help with this relatively simple problem.
I am building a timesheet application using ASP.NET C# with Visual
Studio 2003.As it is only a protoype application, my...
|
by: Trickynick1001 |
last post by:
Hi, a newbie here. I don't have a real firm grasp on the idea of
Javascript, as I'm used to programming in Qbasic and C. I'm not used
to OOP. Anyway, I really don't have any idea what the...
|
by: phil |
last post by:
Hi,
Is this a javascript or asp.net problem?
When the button is clicked, the server event in the code-behind must be
executed if the user clicked on "OK" of the Confirm and not executed if...
|
by: tfsmag |
last post by:
Okay, I have a project management app i'm writing and in the left hand
menu i have a treeview control that is populated with each project...
in child nodes under each project node I have an "edit"...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
| |