搜索文档
首页
HTML/CSS
JavaScript
服务端开发
Java教程
移动端
数据库
当前位置:
首页
JavaScript
JavaScript 教程
JavaScript基础教程
源代码
清空
点击运行
<!DOCTYPE html> <html> <title>JavaScript 随机数 Math.random() 方法示例 - 基础教程(div.cn)</title> <head> <style> div { background: lightgreen; padding: 40px 20px; text-align: center; font-size: 10vw; } </style> </head> <body> <h1>JavaScript Math.random() 方法</h1> <p>将鼠标指针移到下面的DIV上:</p> <div onmousemove="this.innerHTML=Math.random();" onmouseout="this.innerHTML='Mouse Over me!!!'">Mouse Over me!!!</div> </body> </html>
运行结果