Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些 JavaScript 代码在屏幕上打印一个随机字符串,而不是随机数字和字母,只是我创建的单词。所以我需要它,所以如果它随机选择某个字符串,它会将您重定向到不同的页面。
if (randomString == 'patternString') { window.location.href = 'http://google.com'; }
window.location.href = 'https://www.google.com/search?q=' + encodeURIComponent(randomString);