良い一日!
ここの初心者は、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>
前もって感謝します。