TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Madhukar Krishna
688
1.4k
292.2k
Javascript: While loop - looping forever
Mar 15 2014 2:33 PM
When I type "Yes" or "No" it alerts again and again. Please help.
<script type="text/javascript">
var y = prompt("Do you want to enter values, type 'Yes' or 'No'!");
while ((y.toUpperCase()!="YES") || (y.toUpperCase()!="NO"))
{
if (y.toUpperCase()=="YES")
{
alert(y);
}
else if (y.toUpperCase()=="NO")
{
alert(y);
}
else
{
alert("You have type \"" +y+ "\" which is no option! Please type again");
y = prompt("Do you want to enter values, type 'Yes' or 'No'!");
}
}
</script>
Reply
Answers (
6
)
Javascript: Image change not working
How to set priority on elements selected in drop down list