0
我在這裏有幾個問題。隨機字體大小並設置字符的最小和最大值
a)如何在此代碼中添加隨機字體大小?
b)如何設置min(3)和max(8)字符的限制?
的Javascript
function randomString(Length) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (var i = 0; i < Length; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
function ChangingRandomString(Length) {
setInterval(function() {
document.getElementById("random").innerHTML = randomString(Length);
}, 2000);
}