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>
运行代码
查看全文
相关阅读:
ARM启动流程
ARM机器码分析
Ubuntu 14.04 dnw配置
UNIX环境下的消息队列
UNIX环境下的共享内存
iptables详解
iptables 相关名词的解释说明
sphinx的安装配置和中文分词包coreseek
linux防火墙iptables封IP,拒绝指定IP和网段的办法
linux下注销其它用户或者tty的命令
原文地址:https://www.cnblogs.com/jikey/p/1756155.html
最新文章
linux下编译C++文件基本命令
Linux git 安装使用入门
Ubuntu16.04 安装 YouComlpeteMe
Ubuntu16.04 安装使用 Vundle
C++STL为什么要有const_iterator
sqlerrm的关键
近期小知识总结--20170901
openoffice安装
0717--随笔
关于今后学习方向的思考
热门文章
CRM项目上线第一天
2017-06-28项目进展所思
Oracle何时commit???
Oracle启动多实例
Oracle断电后重启异常
安卓微博客户端 第二天 系统主框架的搭建
安卓微博客户端 第一天
对MMU段式转换的理解
字符设备驱动之从用户程序中的系统调用到驱动中的具体实现
对链接地址的理解
Copyright © 2011-2022 走看看