Live Chat Icon For mobile
Live Chat Icon

How to get the confirmation of Yes/No from a javascript pop-up and display the value on the page

Platform: ASP.NET| Category: Client Side Scripting

Code Behind


Button1.Attributes.Add('onclick', 'getMessage()')

Client Side


<SCRIPT language=javascript>
function getMessage() 
{ 
var ans; 
ans=window.confirm(’Is it your confirmation.....?’); 

if (ans==true) 
	{ 
		document.Form1.hdnbox.value=’Yes’; 
	} 
else 
	{ 
		document.Form1.hdnbox.value=’No’;} 
	} 
</SCRIPT> 

To display the Yes/No value selected by user, in your code behind file:


Response.Write(Request.Form('hdnbox')) 

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.