再会!
新手,我在 google 中找到了这个 Javascript,我不知道如何将结果插入到我的新博客文章中。我想在新博客文章中显示随机文本
<script type="text/javascript">
<!--
//I. Array of banner that will randomly appear
var randomquote = new Array ( );
randomquote[0] = '<em>Allergic reactions</em>';
randomquote[1] = '<em>Dental hygiene </em>';
randomquote[2] = '<em>Diabetes</em>';
randomquote[3] = '<em>Back pain</em>';
randomquote[4] = '<em>Weight loss </em>';
randomquote[5] = '<em>Heat cramps</em>';
randomquote[6] = '<em>Heat stroke</em>';
randomquote[7] = '<em>Pain Medication </em>';
randomquote[8] = '<em>Diet plan</em>';
randomquote[9] = '<em>Dehydration</em>';
//II. function to generate number from 0 to n
function randomzero (n)
{
return ( Math.floor ( Math.random ( )*0.9999999999999999* (n + 1)) );
}
//III. assign any random number from 0 to 2 to x.
x = randomzero(2);
//IV. display the text
document.write(randomquote[x]);
//-->
</script>
提前致谢。