***Звёздный форум ***

Объявление

ВНИМАНИЕ!!! Создан новый форум, по адресу https://zvezdny.my1.ru/forum/ Администзрация просит прощения за предоставленные неудобства.

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » ***Звёздный форум *** » Кодинг » JavaScript - Скрипты


JavaScript - Скрипты

Сообщений 1 страница 2 из 2

1

То, что я у себя нашел из старой темы, наиболее полезное...

Бегущая строка в СтатусБаре

Код:
<script language="JavaScript"> 

<!-- var scrollCounter = 0; var scrollText

= "Пример бегущей строки. "; 

var scrollDelay = 70; 

var i = 0; 

while (i ++ < 140) 

scrollText = " " + scrollText; 

function Scroller() 

{ 

window.status = scrollText.substring(scrollCounter++, 

scrollText.length); 

if (scrollCounter == scrollText.length) 

scrollCounter = 0; 

setTimeout("Scroller()", 

scrollDelay);}Scroller(); 

//--> 

</script>

К курсору привязаны слова

Код:
<body bgcolor="#000000" link="#FFFF99" vlink="#FFFF99" 
alink="#FFFF99" onload="makesnake()" 
style="OVERFLOW-X: hidden; OVERFLOW-Y: scroll; WIDTH: 100%">
<p><br><STYLE fprolloverstyle></p>
<p>A:hover { COLOR: #ffFFFF; FONT-WEIGHT: bold; TEXT-DECORATION:
blink } </STYLE> <STYLE>.spanstyle { FONT-FAMILY: Arial; FONT-SIZE: 14pt;
POSITION: absolute; TOP: 150px; VISIBILITY: visible } </STYLE><font
color="#ffffff"> 

<script>
var x,y
var step=15
var flag=1
var message=" text "
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length-1;i++) 
{ xpos[i]=-50 }
var ypos=new Array()
for (i=0;i<=message.length-1;i++) { ypos[i]=-50 }
function handlerMM(e){
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
flag=1
}
function makesnake() {
if (flag==1 && document.all) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("span"+(i)+".style")
thisspan.posLeft=xpos[i]
thisspan.posTop=ypos[i]
}
}
else if (flag==1 && document.layers) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("document.span"+i)
thisspan.left=xpos[i]
thisspan.top=ypos[i]
}
}
var timer=setTimeout("makesnake()",30)
}
</script> <script>
<!-- Beginning of JavaScript -
for (i=0;i<=message.length-1;i++) {
document.write("<span id='span"+i+"' class='spanstyle'>")
document.write(message[i])
document.write("</span>")
}
if (document.layers){
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// - End of JavaScript - -->
</script>

На страничке идет снег

Код:
<script language=JavaScript1.2>
//Configure below to change URL path to the snow image
var snowsrc="http://mpchat.com/smile/img/snow.gif"

// Configure below to change number of snow to render
var no = 15;

var ns4up = (document.layers) ? 1 : 0; &nbsp;// browser sniffer
var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

var dx, xp, yp; &nbsp; &nbsp;// coordinate and position variables
var am, stx, sty; &nbsp;// amplitude and step variables
var i, doc_width = 800, doc_height = 600;

if (ns4up||ns6up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
} else if (ie4up) {
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}

dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();

for (i = 0; i < no; ++ i) { &nbsp;
dx[i] = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// set coordinate variables
xp[i] = Math.random()*(doc_width-50); &nbsp;// set position variables
yp[i] = Math.random()*doc_height;
am[i] = Math.random()*20; &nbsp; &nbsp; &nbsp; &nbsp; // set amplitude variables
stx[i] = 0.02 + Math.random()/10; // set step variables
sty[i] = 0.7 + Math.random(); &nbsp; &nbsp; // set step variables
if (ns4up) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// set layers
 &nbsp;if (i == 0) {
 &nbsp; &nbsp;document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"></a></layer>");
 &nbsp;} else {
 &nbsp; &nbsp;document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"></layer>");
 &nbsp;}
} else if (ie4up||ns6up) {
 &nbsp;if (i == 0) {
 &nbsp; &nbsp;document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"></a></div>");
 &nbsp;} else {
 &nbsp; &nbsp;document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"></div>");
 &nbsp;}
}
}

function snowNS() { &nbsp;// Netscape main animation function
for (i = 0; i < no; ++ i) { &nbsp;// iterate for every dot
 &nbsp;yp[i] += sty[i];
 &nbsp;if (yp[i] > doc_height-50) {
 &nbsp; &nbsp;xp[i] = Math.random()*(doc_width-am[i]-30);
 &nbsp; &nbsp;yp[i] = 0;
 &nbsp; &nbsp;stx[i] = 0.02 + Math.random()/10;
 &nbsp; &nbsp;sty[i] = 0.7 + Math.random();
 &nbsp; &nbsp;doc_width = self.innerWidth;
 &nbsp; &nbsp;doc_height = self.innerHeight;
 &nbsp;}
 &nbsp;dx[i] += stx[i];
 &nbsp;document.layers["dot"+i].top = yp[i];
 &nbsp;document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
}
setTimeout("snowNS()", 10);
}

function snowIE_NS6() { &nbsp;// IE and NS6 main animation function
for (i = 0; i < no; ++ i) { &nbsp;// iterate for every dot
 &nbsp;yp[i] += sty[i];
 &nbsp;if (yp[i] > doc_height-50) {
 &nbsp; &nbsp;xp[i] = Math.random()*(doc_width-am[i]-30);
 &nbsp; &nbsp;yp[i] = 0;
 &nbsp; &nbsp;stx[i] = 0.02 + Math.random()/10;
 &nbsp; &nbsp;sty[i] = 0.7 + Math.random();
 &nbsp; &nbsp;doc_width = ns6up?window.innerWidth : document.body.clientWidth;
 &nbsp; &nbsp;doc_height = ns6up?window.innerHeight : document.body.clientHeight;
 &nbsp;}
 &nbsp;dx[i] += stx[i];
 &nbsp;if (ie4up){
 &nbsp;document.all["dot"+i].style.pixelTop = yp[i];
 &nbsp;document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
 &nbsp;}
 &nbsp;else if (ns6up){
 &nbsp;document.getElementById("dot"+i).style.top=yp[i];
 &nbsp;document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i]);
 &nbsp;} &nbsp; 
}
setTimeout("snowIE_NS6()", 10);
}

if (ns4up) {
snowNS();
} else if (ie4up||ns6up) {
snowIE_NS6();
}
</SCRIPT>

2

Скролл текста в рамке

Код:
<script LANGUAGE="JavaScript">
<!-- Begin
document.write('<marquee id="iescroller" direction="up" width="100%" height="65" scrollamount="1" scrolldelay="100" style="border:1 solid white;background-color:#374B6">');
iescroller.onmouseover=new Function("iescroller.scrollAmount=0");
iescroller.onmouseout=new Function("iescroller.scrollAmount=2");

document.write('<font size="3" face="Arial" color="#FFFFFF">')
document.write('<Div align="center">Добро пожаловать в НАШ ЧАТ!!! </div><br>');
document.write('<Div align="center">НАШ ЧАТ</div><br>');
document.write('<Div align="center">Самый чатлански чат из чатов чатландии...</div><br><br>');

document.write('</font>');
document.write('</marquee>');
//  End -->
</script>

светящийся текст (типа неоновой мигающей вывески)

Код:
<span span id="glowtext" style="text-decoration: none">
 <font color="#000080"><span style="text-decoration: none">ТЕКСТ</span>
 </font></span>
 <style>
                                                <!--
                                                #glowtext{
                                                filter:glow(color=red,strength=3);
                                                width:100%;
                                                }
                                                -->
                                                </style>
 <script language="JavaScript1.2">

                                                /*
                                                Glowing Text Script-
                                                © Dynamic Drive (www.dynamicdrive.com)
                                                For full source code, installation instructions,
                                                100's more DHTML scripts, and Terms Of
                                                Use, visit dynamicdrive.com
                                                */

                                                function glowit(which){
                                                if (document.all.glowtext[which].filters[0].strength==3)
                                                document.all.glowtext[which].filters[0].strength=2;
                                                else
                                                document.all.glowtext[which].filters[0].strength=3;
                                                }

                                                function glowit2(which){
                                                if (document.all.glowtext.filters[0].strength==3)
                                                document.all.glowtext.filters[0].strength=2;
                                                else
                                                document.all.glowtext.filters[0].strength=3;
                                                }

                                                function startglowing(){
                                                if (document.all.glowtext&&glowtext.length){
                                                for (i=0;i<glowtext.length;i++)
                                                eval('setInterval("glowit('+i+')",150)');
                                                }
                                                else if (glowtext);
                                                setInterval("glowit2(0)",150);
                                                }

                                                if (document.all)
                                                window.onload=startglowing;
                                                </script>

пример обьёмного текста

Код:
<H1 
style="FILTER: shadow(color:996633,direction=225,enabled:1); FONT-FAMILY: verdana; COLOR:lightgreen; 
FONT-SIZE: 30px; LINE-HEIGHT: 40px; WIDTH: 85%">Объемный текст</H1>

Отправляет в поле ввода текста выбранную из выпадающего меню фразу. Возможность добавления своих.

Должно работать во всех фреймах. Само слово *[---- Фразы ----]* выбираться не будет. Правда не тестил во всех браузерах, но, думаю, будет работать.

Это между тегами <head> и </head>

Код:
<script>
/* Фразы */
var Sym=" Всем привет! , Всем пока! , Привет! , Пока! , Как дела? , Как жизнь? , Что-то я скучаю , Мне пора , Исчезаю на 5 мин ";

function SendTo(element) { 
fraza = element.options[element.selectedIndex].value;
parent.chat.fmsg.text0.value= parent.chat.fmsg.text0.value + fraza; 
parent.chat.fmsg.text0.focus(); }

var Clicked = false;

function ClickSymbol(element) {if (!Clicked) {element.selectedIndex = 0; Clicked=true;} else Clicked = false;}

function fraza () {

/* Настройка поля select */
var List = '<select name="fraza" class=text onchange="SendTo(this);" onclick="ClickSymbol(this);"><option>[---- Фразы ----]</option>';

var SymbArray = new Array();SymbArray = Sym.split(',');var Code;
for (var Ix=0; Ix<SymbArray.length; Ix++) {
Code = SymbArray[Ix].substring(0,30);
List += '<option value="'+Code+'">'+Code; }
List += '</select>';document.write(List); }
</script>

Это между тегами <body> и </body>

Код:
<script>fraza();</script>

Скрипт, позволяющий полностью настраивать вид *подсказки*, работает во всем. Если кому нужно:
в HEAD

Код:
<script src='http://mpchat.com/imperia/scripts/tooltip.js' language='javascript'></script>
<style>
#tooltip {
background: #ЦВЕТ ФОНА;
border: НАСТРОЙКА РАМКИ;
text-align: ВЫРАВНИВАНИЕ;
font: НАСТРОЙКА ТЕКСТА;
margin: 0px;
-moz-border-radius: 8px;
padding: 3px 3px;
position: absolute;
visibility: hidden; }
</style>

Также можно залить скрипт куда-угодно себе на сайт...

Блокирует правую кнопку мышки:

Код:
<script LANGUAGE="JavaScript"> 
<!-- 
document.oncontextmenu = function(){return false} 
if(document.layers) { 
window.captureEvents(Event.MOUSEDOWN); 
window.onmousedown = function(e){ 
if(e.target==document)return false; 
} 
} 
else { 
document.onmousedown = function(){return false} 
} 
// --> 
</script>

Вы здесь » ***Звёздный форум *** » Кодинг » JavaScript - Скрипты