2022-05-13 12:32:23
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
写了个例子 随机数1-10<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title></head><body><input type="text" id='tx'><button onclick="rd()">计算</button><textarea id='con' style="width: 200px;height: 500px"></textarea></body><script type="text/javascript">function rd () {nb=document.getElementById('tx').value;s='';for(i=0;i<nb;i++){s=s+Math.ceil(Math.random()*10)+'\n';}document.getElementById('con').value=s;}</script></html>