Random Quote on Page
| 18.06.2009, 14:28 |
Этот
скрипт позволяет отображать случайное сообщение.----------------------------------------------------------------- Пример использования скрипта:----------------------------------------------------------------- Код скрипта: Вставьте следующий код между тегами <BODY></BODY>
<span id="my_quote"></span> <script type="text/javascript">function get_random(maxNum) { var ranNum= Math.floor(Math.random()*(maxNum)); return ranNum; }
function getaQuote() { if (document.getElementById && document.createTextNode) {
var quote=new Array() quote[0]="Starting right meow?"; quote[1]="It\'s got electrolytes."; quote[2]="Just wanted to let you know- we\'re all counting on you."; quote[3]="What\'s the matter Colonel Sanders? Chicken?"; quote[4]="Rodents of Unusual Size? I don't think they exist."; quote[5]="You keep using that word. I do not think it means what you think it means."; quote[6]="Inconceivable!"; quote[7]="Nooooooooooooooo!"; quote[8]="Try not. Do or do not. There is no try."; quote[9]="Gosh!";
var whichQuote=get_random(quote.length);
var thequote = document.getElementById("my_quote"); thequote.innerHTML = quote[whichQuote]; } }
getaQuote();
</script>
|
Категория: Разное | Добавил: Администратор |
Просмотров: 405 | Загрузок: 0
| Рейтинг: 0.0/0 |
Добавлять комментарии могут только зарегистрированные пользователи.
[
Регистрация |
Вход ]