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 3140
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 Page_Load(object sender, System.EventArgs e)
{
if(! Page.IsPostBack)
|
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 confirm box or ASP.NET has such
feature??
Million thanks.
|
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 have created an Is_Dirty routine checking for field changes on my page
then if the user clicks on the "exit" button I check for Is_Dirty = true and
want to ask then "do you want to exit without saving?". It's a code behind
where if the value of...
|
by: Tarun Upadhyaya |
last post by:
Hi,
I am facing strange problem
I read Scott mitchell's article about ASP.NET and javascript at
http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/clientsidescript.asp
where he has talked about creating a base class for displaying alerts and
confirms after and before postbacks respectively.
I used that Base class to inherit on of my code behind classes and and i
|
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 clicked. I thought the
control might be the problem, so i deleted the old control and binded
the new linkbutton control but am still getting the same error. Am
using visual studio 2005.
Source code inside my grid:...
| |
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 database has been
made in MSDE.
I have a DataGrid, and have inserted a delete link button into it
through Property Builder. My Delete method works fine, however I would
like to insert a JScript popup to confirm, as otherwise users can just
|
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 problem is with
this code, it just simply won't work properly. Some of the functions
aren't done, but the main one gives me a Not a Number message in the
text box where the calculations are supposed to come up. I tried to
use a parseInt on my stuff,...
|
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
clicked on "Cancel". I tried two ways: the first here below works perfect
but the second way ALWAYS executes the server event!!
Can anybody explain me why?
Thanks
|
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" and a "delete"
node. I have the functionality of the edit and delete working fine, my
issue is now however that I cannot seem to find a way to add an
"onclick" event that fires a confirm box. I've tried this method..
treenode.Text = "<a...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |