此脚本应从可用字符中选择一个随机单词并将其添加到 url 的末尾,但它似乎不起作用。你能确定我在哪里制造问题吗?
<script type="text/javascript">
function randomEI1(len) {
var chars = [ "apple", "google", "ebay" ];
var string_length = len;
var randomstring ='';
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum, rnum + 1);
}
return randomstring;
}
var ei1 = randomEI1(1);
document.write('<script type="text/javascript" src="http://www.site.com' + ei1 + '"><\/script>');
</script>