<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> <script type="text/javascript"> var randomNumber = Math.floor(Math.random() * 1000) + 1000; // 生成 4 位随机数字 alert(randomNumber); </script> </body> </html>