0% found this document useful (0 votes)
16 views15 pages

Lecture-6 Dialog Boxes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views15 pages

Lecture-6 Dialog Boxes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

INSTITUTE OF INFORMATION TECHNOLOGY & MANAGEMENT

Accredited ‘A’ Grade by NAAC &Recognised U/s 2(f) of UGC act


Rated Category `A+’ by SFRC & `A’ by JAC Govt. of NCT of Delhi
Approved by AICTE & Affiliated to GGS Indraprastha University, New Delhi

Web Technologies
BCA
Semester: I
Paper code:-BCA 105T

© Institute of Information Technology and Management, D-29, Institutional Area, Janakp


uri, New Delhi-110058
Dialogue Boxes
Dialogue boxes are a kind of popup notification,
this kind of informative functionality is used to
show success, failure, or any particular/important
notification to the user.
JavaScript uses 3 kinds of dialog boxes:
Alert
Prompt
Confirm
 These dialog boxes can be of very much help in making
our website look more attractive.
© Institute of Information Technology and
Management, D-29, Institutional Area, Janakpuri,
New Delhi-110058
Alert Box
• An alert box is used on the website to
show a warning message to the user that
they have entered the wrong value other
than what is required to fill in that position.
Nonetheless, an alert box can still be used
for friendlier messages. The alert box gives
only one button “OK” to select and
proceed.

© Institute of Information Technology and Manage


ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
Alert Box Example
<html>
<head>

</head>

<body>
<script language="javascript" type = "text/javascript">

function Warning()
{
alert ("Warning you have not filled everything");

}
</script>
© Institute of Information Technology and Manage
ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
<p>Click the button to check the Alert Box functionality</p>
<form>
<input type="button" value="Click Me" onclick="Warning();"
>
</form>

</body>
</html>

© Institute of Information Technology and Manage


ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
Output

© Institute of Information Technology and Manage


ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
Confirm Box
• A confirm box is often used if you want the
user to verify or accept something. When a
confirm box pops up, the user will have to
click either “OK” or “Cancel” to proceed. If
the user clicks on the OK button, the
window method confirm() will return true. If
the user clicks on the Cancel button, then
confirm() returns false and will show null.

© Institute of Information Technology and Manage


ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
Example
<html>
<head></head>
<body>

<script type="text/javascript">

function Confirmation()
{
var Val = confirm("Do you want to continue ?");
if (Val == true) {
document.write(" CONTINUED!");
return true;
} else {
document.write("NOT CONTINUED!");
return false;
}
}
</script>

© Institute of Information Technology and Manage


ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
<p>Click the button to check the Confirm Box functionality</p>
<form>
<input type="button" value="Click Me"
onclick="Confirmation();" >
</form>
</body>

</html>

© Institute of Information Technology and Manage


ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
Output

© Institute of Information Technology and Manage


ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
Prompt Box
 A prompt box is often 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 either “OK” or
“Cancel” to proceed after entering an input
value. If the user clicks the OK button, the
window method prompt() will return the
entered value from the text box. If the user
clicks the Cancel button, the window
method prompt() returns
© Institute of Information Technology and Manage
null.
ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
Example
<html>
<head></head>
<body>

<script type="text/javascript">
function Value(){
var Val = prompt("Enter your name : ", "Please enter your name");
document.write("<h1> Hello " + Val + ", Welcome to Javascript
Programming!</h1>");
}

</script>
© Institute of Information Technology and Manage
ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
<p>Click the button to check the Prompt Box functionality</p>
<form>
<input type="button" value="Click Me" onclick="Value();" />
</form>
</body>
</html>

© Institute of Information Technology and Manage


ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
Output

© Institute of Information Technology and Manage


ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058
Output

© Institute of Information Technology and Manage


ment, D-29, Institutional Area, Janakpuri, New Delh
i-110058

You might also like