zoukankan
html css js c++ java
随机显示数字
主要知识点有:
数组的两种新建方式,
Math.random函数的运用
innerHTML与 += 运算符的运用
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>豪情</title> </head> <body> <span id="t"></span> <script type="text/javascript"> var texts = new Array('中国', '西安', '上海', '中国', '西安', '上海'); var colors = ['red', 'blue', 'gray', 'orange']; for(var i=0; i<texts.length; i++){ //alert(parseInt(Math.random()*colors.length)); document.getElementById('t').innerHTML += "<span style='font-weight:bold;margin:0 10px;color:" + colors[parseInt(Math.random()*colors.length + 1)] + ";'>" + texts[i] + "</span>"; } </script> </body> </html>
运行代码
查看全文
相关阅读:
转 SpringCloud服务注册中心比较:Consul vs Zookeeper vs Etcd vs Eureka
转 微服务的4个设计原则和19个解决方案
骑士问题
种树(洛谷P1250)
你的飞碟在这儿(洛谷P1200)
Hello world
[zt][cocos2dxwin32] 安装部署流程整理
(ZT)关于IAP防止破解的几点
(ZT)UIImage应用与内存管理
在Mac上发布QT的程序
原文地址:https://www.cnblogs.com/jikey/p/1756155.html
最新文章
在web.config中添加mime类型
nginx配置记录
mysql复制数据库
linux项目部署过程
mysql常用命令
手把手搭建自己的android环境
No image!使用bordercolor属性来制作小三角形
浅谈购物车中cookie的使用
探讨行内元素转换为块级元素
react native的环境搭建中常见问题
热门文章
ES6学习笔记之变量声明let,const
js原型对象中属性被覆盖(1)
夺命的中国IT互联网行业
Android面临困境:系统现碎片化 开发者兴趣下滑
挑战者诺基亚
为何华为手机干不过小米
恶搞iPhone4粉丝
SpringBoot学习之路踩坑系列:访问静态资源
为什么不应该使用Zookeeper做服务发现?(转载)
转 ZooKeeper是按照CP原则构建的,不适合做Service服务发现
Copyright © 2011-2022 走看看