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



My Profile

Gifts

Active Members
TodayLast 7 Days more...








prompt, confirm ,alert all together



This article explains usage of alert ,prompt,confirm





Let's put all together with some conditional statement in one example and proceed further.



<body>

<script type="text/javascript">

var v=window.prompt("Enter your rating from 1 to 10 scale in JavaScript");

confirm("Are you sure you want to see the rating");

if(v>5)
alert('Good');

else if(v==5)
alert('Moderate');

else
alert('Poor');


</script>

</body>



Here if is a conditional statement that checks value of v. If v is greater than 5 then an alert message is fired with message as Good.

If v is equals to 5 then corresponding message is fired.

Apart from above two cases for all the other a message box with message ‘Poor’ is displayed.

Note
Script tag can be placed in Header or body but if you want to place it in the body you need to mention language = JavaScript . But in header it’s an optional since it take JavaScript in Body by default

I think now you are confident enough on alert, confirm, prompt.

Let's move on to the next chapter then...






Next Chapter: Calling JavaScript function in an Event


Previous Chapter: Working with confirm and prompt


Tutorial Index




Read TATA Nano reviews.
dotNet Slackers   BizTalk Adaptors    Web Design   Scripts
Are you waiting for engineering entrance result? Watch here for engineering entrance results.
doors in nj

Contact Us    Privacy Policy    Terms Of Use