JS Basic _while Exercises 2

Source: Internet
Author: User

1 <!DOCTYPE HTML>2 <HTML>3     <Head>4         <MetaCharSet= "Utf-8" />5         <title>If Exercise 1</title>6         <Scripttype= "Text/javascript">7             /*8 * Enter Xiao Ming's final results from the keyboard:9 * When the score is 100, ' reward a BMW 'Ten * When the score is [80-99], ' reward a iphone15s ' One * When the score is [60-80], ' reward a reference book ' A * Other time, what reward is not -              */ -              the             /* - * Prompt () can pop up a prompt box with a text box - * User can enter a paragraph in the text box, the function needs a string as a parameter, - * The string will be the prompt text of the prompt box +              *  - * The user input will be returned as the function's return value, you can define a variable to receive the content +              */ A             //put the prompt into a loop at              while(true){ -                 //score is Xiao Ming's final grade. -                 varscore=Prompt ("Please enter Xiao Ming's final result (0-100):"); -                 //determine if the value entered by the user is legitimate -                 if(Score>= 0 &&score<=  -){ -                     //satisfying this condition proves that the user's input is legal and exits the loop in                      Break; -                 } to                  + Alert ("Please enter a valid score!!! "); -             } the              *              $             Panax Notoginseng             //Judging whether the value is legal -             if(Score>  - ||score< 0 ||IsNaN (Score)) { the Alert ("pull out and shoot."); +             }Else{ A                 //according to the value of score to decide what reward for Xiao Ming the                 if(Score==  -){ +                     //reward a BMW - Alert ("BMW, take it ~ ~ ~"); $                 }Else if(Score>=  the){ $                     //reward a cell phone - Alert ("mobile phone, take to play ~ ~ ~"); -                 }Else if(Score>=  -){ the                     //reward a reference book - Alert ("reference books, take to see ~ ~ ~");Wuyi                 }Else{ the Alert ("stick a root ~ ~"); -                 } Wu             } -              About              $              -              -              -              A         </Script> +     </Head> the     <Body> -          $     </Body> the </HTML>

JS Basic _while Exercises 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.