<script type="text/javascript"> //随机取得数组中的一个 var Arr = ["a","b","c","d"]; var n = Math.floor(Math.random() * Arr.length + 1)-1; alert(Arr[n]); </script>