473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

"i want used confirm in javascript in code behind"

Hai....

"i want used confirm in javascript in code behind"

i am used confirm button ,,,in code behind.

if the confirm button worked

the function is return the true...

else

the function return the false..

i want to get true and false value for my further proces..

this my code..

Dim popupScript6 As String = "<script language='javascript'>var agree= confirm('Are you sure to cancel the ticket?');if(agree){ return true};else {return false;}</script>"
'Page.RegisterStartupScript("PopupScript6", popupScript6)

in my codebehind window i want to get "agree" value....

in this popupScript6 used confirm coding is worked...but i wrote return word..this is nothing done..

i ma used return word is not worked..

please how can use this statement..

how can i get return value..

because i got the return value..

then my next code if(true) the redirect to another page...

so please hrlp me...

i am used this code also code..

but the same process done this also return word is used in not working..

this code..

Dim str As StringBuilder = New StringBuilder
str.Append("<script language='javascript'>")

str.Append("var agree= confirm('Are you sure to cancel the ticket?');")
str.Append("if(agree){")

str.Append("return true;}")
str.Append("else {")

str.Append("return false;}")
str.Append("</script>")
RegisterStartupScript("TicketNumber", str.ToString)

so please help me...
Jun 13 '07 #1
1 1964
gits
5,390 Expert Mod 4TB
hi ...

there is an error with your javascript:

Expand|Select|Wrap|Line Numbers
  1. var agree = confirm('Are you sure to cancel the ticket?');
  2.  
  3. // have a close look at your condition where i commented the 
  4. // error
  5.  
  6. if(agree) {
  7.     return true
  8.     // you miss the ; here and put it instead behind the brace 
  9.     // this if-else-statement will not work
  10. }; else {
  11.     return false;
  12. }
  13.  
as an alternative you may use the following:

Expand|Select|Wrap|Line Numbers
  1. var agree = confirm('Are you sure to cancel the ticket?');
  2.  
  3. // until agree has the value you want to return ... simply do it ;)
  4. return agree;
  5.  
or more simple:

Expand|Select|Wrap|Line Numbers
  1. return (confirm('Are you sure to cancel the ticket?'));
  2.  
kind regards ...
Jun 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: delerious | last post by:
I see some code examples like this: <DIV onmouseover="this.style.background='blue'"> and other code examples like this: <DIV onmouseover="javascript:this.style.background='blue'"> Which...
1
by: Alan | last post by:
I post this message here because I have post in js.group before, but onone answer, thus i guess this is ASP issue. <A HREF="http://SomeWebSite" OnClick="return confirm('Are you sure?')">Click...
4
by: Rui Santos | last post by:
Folks, How can change the text labels in the "confirm" buttons? Instead OK and Cancel, i want "Yes" and "No". Regards, Rui
7
by: calan | last post by:
I need a dialog box with Yes, No, and Cancel buttons that pops up when a link is clicked. I'm using asp on the server side, and basically, if the user clicks yes, I want to go to a certain page...
7
by: RFS666 | last post by:
Hello, I would like to use variables with a type in jscript.NET. I declare them as follows: var x : double = 5.03; This doesn't work in my script, that I write to the page in codebehind with...
0
by: JT | last post by:
In looking around on the internet to find out how to use a "messagebox"-like window on a webform, I have come across a few examples of how to do so from the "onclick" event of a button. In my...
2
by: Navodit | last post by:
Hi I am new to Javascript and am not sure what is the difference between the following two statements: <script type="text/javascript"> ..... </script>
2
by: thirunavukarasukm | last post by:
Hai.... "i want used confirm in javascript in code behind" i am used confirm button ,,,in code behind. if the confirm button worked the function is return the true...
9
by: Steve | last post by:
Hi; I've being going through some legacy code on an old JSP site I have been patching. I noticed that when I save the JSP down to my PC as an HTML file I get this javascript error in IE 6 ( ...
8
by: howa | last post by:
Just found a funny things.. in HTML4's dtd, http://www.w3.org/TR/html4/strict.dtd language is not valid, i.e. <!ELEMENT SCRIPT - - %Script; -- script statements --> <!ATTLIST...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.