我在 JavaScript 中做了同样的事情,但我是 JavaScript 新手,我不知道如何转换它......:/
<script language="JavaScript">
<!--
var randomString = new Array ();
randomString[0] = "a random string";
randomString[1] = "another random string";
randomString[2] = "another random string";
randomString[3] = "another random string";
randomString[4] = "another random string";
randomString[5] = "another random string";
randomString[6] = "another random string";
randomString[7] = "another random string";
var i = Math.floor(7*Math.random())
document.write(randomString[i]);
//-->
</script>