Let JS help you decide what to eat for lunch.

Source: Internet
Author: User

The most worrying is what to eat at noon every day, have time to do a JavaScript carousel random selection. The pre-custom menu is carousel, and then the point is selected to determine a paragraph. The code can view the source code on this page, and you can customize the menu array.

The effect demo is ready for lunch.

JavaScript Code

You can modify the definition of the lunch of the array yourself, make a meal selection script it! Suiping County Ausson Advertising

<script type= "Text/javascript" >//here to modify the meal, separated by commas var foodname = ' Ramen, canteen, takeaway, KFC, Pizza hat, comes with ... '; var foodnamearray = Foodname.split (', '); var num = Foodnamearray.length-1;var timer;function $ (o) {return document.getElementById (o);} function Change () {$ (' foodname '). InnerHTML = Foodnamearray[getrun (0,num)];} function Getrun (_min,_max) {return parseint (Math.random () * (_max-_min+1));} function Start () {clearinterval (timer); timer = setinterval (' Change () ', 30);} function Stop () {clearinterval (timer);} </script>

Let JS help you decide what to eat for lunch.

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.