User-க்கு ஒரு செய்தியை காண்பிக்கவோ(display) அல்லது notification மாதிரி தெரியப்படுத்தவோ இந்த Popup Box பயன்படுத்தப்படுகிறது.
javascript-இல் மூன்று வகையான pop up box உள்ளன.
1.Alert Box
2.Confirm Box
3.Prompt Box
Alert Box:
Alert box என்பது user-க்கு ஒரு message-யை display செய்யும்.அந்த message-க்கு கீழ் ok button இருக்கும்,அந்த பட்டனை click செய்யும் வரைக்கும் உங்களால் வேறு எந்த வேலையும் செய்ய முடியாது.
Warning message காண்பிக்க பயன்படுகிறது.box-இல் ok and cancel button இருக்கும்.ok என்றால் true என்றும்,cancel என்றால் false என்றும் அர்த்தம்.
user-கிட்ட இருந்து input வாங்க பயன்படுகிறது.
javascript-இல் மூன்று வகையான pop up box உள்ளன.
1.Alert Box
2.Confirm Box
3.Prompt Box
Alert Box:
Alert box என்பது user-க்கு ஒரு message-யை display செய்யும்.அந்த message-க்கு கீழ் ok button இருக்கும்,அந்த பட்டனை click செய்யும் வரைக்கும் உங்களால் வேறு எந்த வேலையும் செய்ய முடியாது.
<script>
function myFunction() {
alert("I Love Javascript");
}
</script>
Output:
Confirm Box:Warning message காண்பிக்க பயன்படுகிறது.box-இல் ok and cancel button இருக்கும்.ok என்றால் true என்றும்,cancel என்றால் false என்றும் அர்த்தம்.
<script>
function myFunction() {
var button = confirm("Press a button!");
if (button == true) {
document.write("You pressed OK!");
} else {
document.write("You pressed Cancel!");
}
}
</script>
Output:
Prompt Box:user-கிட்ட இருந்து input வாங்க பயன்படுகிறது.
<script>
function myFunction() {
var retVal = prompt("Enter your favourite colour : ", "red");
document.write("You favourite colour : " + retVal);
}
</script>
<button onclick="myFunction()">Try it</button>
No comments:
Post a Comment