C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




obtaining input with confirm() in java script


Posted Date: 11 Oct 2008    Resource Type: Code Snippets    Category: Javascript

Posted By: Bindu Bujji       Member Level: Gold
Rating:     Points: 10



The confirm() function displays a modal dialog box with two buttons, OK , Cancel.
If you select Ok, it returns true else return false.
look at the code below.

Below need to write in script tag under HEAD section.

function processConfirm(answer) {
var result = "";
if (answer) {
result = "Good.An Apple a Day keeps Doctor Aways.";
} else {
result = "You don't want Apple Huh!";
}

return result;
}


Below in script tag of BODY section.

var confirmAnswer = confirm("Do you want Apple to eat?");
var theAnswer = processConfirm(confirmAnswer);
alert(theAnswer)






Responses

Author: Venkat    11 Oct 2008Member Level: Silver   Points : 0
Hi Bindu,
Really good one.
Its really simple and easy to understand.


Author: Venkat    11 Oct 2008Member Level: Silver   Points : 1
Ok..If i want yes,no buttons means how can i get using javascript?

Thanks in advance
Venkat


Author: Bindu Bujji    11 Oct 2008Member Level: Gold   Points : 1
Hi,
There is no option to change the "confirm" box. You can achieve this by using VBscript msgbox.

For more info, refer the following link.

http://www.webdeveloper.com/forum/archive/index.php/t-29979.html





Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Obtaining input with confirm() in java script  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Variable scoping in Java script
Previous Resource: get the specific character from string using javascript
Return to Discussion Resource Index
Post New Resource
Category: Javascript


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

conference calls

Contact Us    Privacy Policy    Terms Of Use