Archive Pages Design$type=blogging

How to Show Pop Up Boxes Using JavaScript?

Using JavaScript you can create three kinds of pop-up boxes, Alert box, Confirm box and prompt box. Alert Box An alert box is used if you wa...

Using JavaScript you can create three kinds of pop-up boxes, Alert box, Confirm box and prompt box.

Alert Box


An alert box is used if you want to make sure information comes through to the user. When an alert box pops up, the user will have to click on "OK" to processed.

Syntax:

alert("Alert Text")

Example:

<html>
<head>
<script type="text/javascript">
function display_alert()
{
alert("This is an alert box!")
}
</script>
</head>
<body>
<input type="button" onclick="display_alert()" value="Display alert box"/>
</body>
</html>

Preview:




 Conform box


A conform box is used if you want the user to verify or accept something. When a conform box pops up, the user will have to click either "OK" or "Cancel" to processed. If the user clicks "OK" the box returns true. If the user clicks "Cancel", the box returns false.

Syntax:

confirm{"Conform Text")

Example:

<html>
<head>
<script type="text/javascript">
function display_conform(){

r=confirm("Press a button");
if (r===true)
{
alert("You pressed OK!");
}
else
alert("You pressed Cancel");
}
</script>
<body>
<input type="button" onclick="display_conform()" value="Display a confirm box"/>
</body>
</html>

Preview:



 Prompt Box


A prompt box is used if you want the user to input a value before entering a page. When a prompt box pops up, the user will have to click "OK" or "Cancel" to processed entering in input value.
If the use clicks "OK" the box returns the input value. If the user clicks "Cancel" the box returns null.

Syntax:

prompt{"sometext", "defaultvalue"}

Example:

<html>
<head>
<script type="text/javascript">
function display_prompt(){
name=prompt("Please enter your name", "Your Name");
if ((name!=null) && name!=" ")
{
alert("Hello "+name+"! How are you today?");
}
}
</script>
</head>
<input type="button"onclick="display_prompt()" value="Display a prompt box"/>
</body>
</html>

Preview:


Related Search Terms

تعليقات

الاسم

Artificial Intelligence(AI) Backlinking Basic IT Best List Blogging Tips C C# C++ Computer Architecture Computer Fundamental Computer Security Computer/IT Officer Exam CSS Data Mining and Warehousing Data Recovery Tools Data Structure Database Management System E-commerce E-government Internet & Web Designing IT Law IT Tips and Tricks IT Tutorials Java JavaScript Keyword Research Tools MIS Multiple Choice Question (MCQ) Networking Online Earning Online IT Jobs Operating System Oracle Forms and Reports Programming Guide Programming Language SEO Social Networking Sites Software Download Software Engineering System Analysis and Design Top List VB.Net
false
rtl
item
Max5: How to Show Pop Up Boxes Using JavaScript?
How to Show Pop Up Boxes Using JavaScript?
Max5
https://maxs27.blogspot.com/2015/02/how-to-show-pop-up-boxes-using.html
https://maxs27.blogspot.com/
http://maxs27.blogspot.com/
http://maxs27.blogspot.com/2015/02/how-to-show-pop-up-boxes-using.html
true
1760660989564394152
UTF-8
لم يتم العثور على اى مواضيع شاهد الكل اقرأ المزيد رد احذف الرد حذف بواسطة الرئيسية صفحات مواضيع شاهد الكل نوصى لك التسميات الارشيف بحث لم يتم العثور على ماتبحث عنه عودة للرئيسية الاحد الاثنين الثلاثاء الاربعاء الخميس الجمعة السبت الاحد الاثنين الثلاثاء الاربعاء الخميس الجمعة السبت يناير فبراير مارس ابريل مايو يونيو يوليو اغسطس سبتمبر اكتوبر نوفمبر ديسمبر يناير فبراير مارس ابريل مايو يونيو يوليو اغسطس سبتمبر اكتوبر نوفمبر ديسمبر just now 1 دقيقة مضت $$1$$ دقيقة مضت 1 hour ago $$1$$ ساعة مضت الامس $$1$$ يوم مضى $$1$$ اسبوع مضى اكثر من 5 اسابيع مضت