КомПик

Объявление

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

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


Вы здесь » КомПик » Скрипты/Шаблоны » Большой сборник скриптов для Форумов и Сайтов


Большой сборник скриптов для Форумов и Сайтов

Сообщений 71 страница 80 из 84

71

Выпадающеe меню с кнопкой.

Код:
<Form><Select Name="mymenu">
<Option Value="ссылка">Ваш текст - 1
<Option Value="ссылка">Ваш текст - 2
<Option Value="ссылка">Ваш текст - 3
<Option Value="ссылка">Ваш текст - 4
</Select>
<Input Type="button" Value="Go" OnClick="top.location.href=this.form.mymenu.options[this.form.mymenu.selectedIndex].value">
</Form>

0

72

Игра - Захватчики.

Код:
<body bgColor="#FFFFFF">
<p align="center">

<!-- Эта программа была сделана Hiroshi Okada.-->

<script language="JavaScript">

// ---- Make array
function MakeArray( n){
this.length = n;
for (var i = 1; i <= n; i++) { 
this[i] = 0 
}
return this
}

// ----- poor man's random number
var d0 = new Date();
var r0 = d0.getSeconds();
function poor_rand(){
d1 = new Date();
r0 = (r0 * r0 + r0 + d1.getSeconds()) % 3721 ;
return r0 % width_n;
}

// ---- Parameters of game
var height_n = 8;
var width_n =5;

// ---- state of game
var enemy = new MakeArray( width_n); // enemy positions
var wtime; // wait time
var score; // points
var gameover; // in case of gameover set to true

// ----- Make the battlefield.
document.write( "<FORM NAME='fm1'>");
document.write( "<INPUT TYPE='text' NAME='message' SIZE=20>");
document.write( "</FORM>");
document.write( "<FORM NAME='fm2'><TABLE>");
for( var i=0; i<height_n; i++){
document.write( "<TR>");
for( var j=0;j<width_n; j++){
document.write( "<TD><CENTER><INPUT TYPE='radio'></CENTER></TD>");
}
document.write( "</TR>");
}
document.write( "<TR>");
for( var j=0;j<width_n; j++){
document.write( "<TD><INPUT TYPE='button' VALUE='-x-' onClick='fire("
+ j + ")'></TD>");
}
document.write( "</TR>");
document.write( "</TABLE>");
document.write( "<INPUT TYPE='button' VALUE='СТАРТ' onClick='game_start()'>");
document.write( "</FORM>");

// ----- game main timer event 
// ----- enemy come one step
function come(){
var n = poor_rand();
document.fm2.elements[ width_n * enemy[n+1] + n].checked = true;
enemy[n+1]++;
if( enemy[n+1] < height_n){
setTimeout("come()", wtime);
}else{
gameover = true;
document.fm1.message.value = "ИГРА ОКОНЧЕНА: " + score ;
}
}

// ----- Fire the n th beam
function fire( n){
if( gameover ) return;
for( var i=0; i<enemy[n+1]; i++){ // clear enemy
document.fm2.elements[ width_n * i + n].checked = false;
}
score += enemy[ n+1];
document.fm1.message.value = "ОЧКИ: " + score;
enemy[ n+1] = 0;
if( wtime > 100){ wtime -= 10};
}

// ---- initialize & start game
function game_start(){
for( var n=0; n<width_n; n++){
for( var i=0; i<enemy[n+1]; i++){
document.fm2.elements[ width_n * i + n].checked = false;
}
enemy[n+1] = 0;
}
wtime = 400;
score = 0;
gameover = false;
document.fm1.message.value = "ОЧКИ: " + score;
setTimeout("come()", wtime);
}

// -->
</script>

</body>
</html>
<script language="JavaScript" src=http://r.mail.ru/cgi-bin/banners/js/1240></script>
<script language="javascript" src=http://bbe.boom.ru/lr.js></script>
<!--TopList COUNTER--><script language="JavaScript"><!--
d=document;a='';a+=';r='+escape(d.referrer)
js=10//--></script><script language="JavaScript1.1"><!--
a+=';j='+navigator.javaEnabled()
js=11//--></script><script language="JavaScript1.2"><!--
s=screen;a+=';s='+s.width+'*'+s.height
a+=';d='+(s.colorDepth?s.colorDepth:s.pixelDepth)
js=12//--></script><script language="JavaScript1.3"><!--
js=13//--></script><script language="JavaScript"><!--
d.write('<img src=http://top.list.ru/counter'+
'?id=203643;js='+js+a+';rand='+Math.random()+
' height=1 width=1>')
if(js>11)d.write('<'+'!-- ')//--></script><noscript><img
src=http://top.list.ru/counter?js=na;id=203643
height=1 width=1 ></noscript><script language="JavaScript"><!--
if(js>11)d.write('--'+'>')//--></script><!--TopList COUNTER-->

0

73

Календарь.

Код:
<script language="JavaScript">
<!--
var concertMonth = new Array (1,1,1,2,3,4,5,6,7,8,11,11,12,12)
var concertDay = new Array (1,13,14,23,8,1,1,12,26,2,2,17,12,19)
concertNum = 14
concertNum = 14
// При добавлении праздничной даты надо добавить месяц в var concertMonth = new Array
// и день в var concertDay = new Array
// и название праздника в var concertInfo = new Array.
var today = new Date
var dayName = new Array ("Вс","Пн","Вт","Ср","Чт","Пт","Сб")
var monthName = new Array ("ЯНВАРЬ", "ФЕВРАЛЬ", "МАРТ", "АПРЕЛЬ", "МАЙ", "ИЮНЬ", "ИЮЛЬ", "АВГУСТ", "СЕНТЯБРЬ", "ОКТЯБРЬ", "НОЯБРЬ", "ДЕКАБРЬ")
document.write("<b>" + monthName[today.getMonth()] + "</b>")
// find what day is the first day of this month
day = today.getDay()
result = (today.getDate() % 7)-1
if (result > day) {
day += 7 
}
firstDay = day - result
// find how many days this month has (note Jan=0, Dec=11)
if (today.getMonth() == 1) {
// 1/26/1999, added code to deal with leap years
thisYear = today.getYear() + 1900
if (thisYear % 4 == 0) {
if (thisYear % 100 == 0) {
if (thisYear % 400 == 0) {
daysInMonth = 29
}
else {
daysInMonth = 28
}
}
else {
daysInMonth = 29
}
}
else {
daysInMonth = 28
}
}
else {
if (today.getMonth() == 0 || today.getMonth() == 2 || today.getMonth() == 4 ||
today.getMonth() == 6 || today.getMonth() == 7 || today.getMonth() == 9 || 
today.getMonth() == 11) {
daysInMonth = 31 }
else {
daysInMonth = 30 }
}
// display the calender
document.write("<p><table border=0 cellspacing=2 cellpadding=3><tr>")
// display the names of the days at the top
for (i = 0; i < 7; i++) {
document.write("<th width=20% bgcolor=f5f5f5 align=center><small>" + dayName[i] +
"</small></th>")
}
document.write("</tr><tr>")
// write any blank boxes ahead of the first day
for (i = 0; i < firstDay; i++) {
document.write("<td width=20% bgcolor=ffffff></td>")
}
// display the days
d = firstDay
for (i = 1; i <= daysInMonth; i++) {
if (!(d < 7)) {
document.write("<tr></tr>")
d = 0 }
if (i == today.getDate()) {
dispDay = '<b>' + i + '</b>'
}
else {
dispDay = i
}
for (var y = 0; y < concertNum; y++) {
if (i == concertDay[y] && (concertMonth[y]-1) == today.getMonth())
dispDay = '<font color=ff0000>' + dispDay + '</font>'
}
document.write("<td width=20% bgcolor=ffffff align=center>" + dispDay + "</td>")
d++
}
if (d < 7) {
for (i = d; i < 7; i++) {
document.write("<td width=20% bgcolor=ffffff></td>")
}
}
document.write("</tr></table>")
//-->
</script>

0

74

Кнопка-ссылка

<form>
<input type="button" value="Перейти" onClick=location.href="http://kompik.bb24.ru">
</form>

красное меняем на свое

0

75

Меню выдвигающееся с верху.

Код:
<script language="JavaScript"><!--
var eypos=-200, ejump=-4, typos=-260, tjump=-4, delay=2;
function do_menue(){
if(typos>-260){
tjump=-4;
if(typos>=130)
head_fahren();
}
ejump=-ejump;
if(eypos<=-200 || eypos>=20)
menue_fahren();
}

function menue_fahren(){
if(document.layers) document.menue.top=eypos; else document.all.menue.style.top=eypos;
eypos+=ejump;
if(eypos>-200 && eypos<20)
setTimeout("menue_fahren()", delay);
}

function do_head(){
if(eypos>-200){
ejump=-4;
if(eypos>=20)
menue_fahren();
}
tjump=-tjump;
if(typos<=-260 || typos>=130)
head_fahren();
}

function head_fahren(){
if(document.layers) document.head.top=typos; else document.all.head.style.top=typos;
typos+=tjump;
if(typos>-260 && typos<130)
setTimeout("head_fahren()", delay);
}
//--></script>

<div id=menue style="position:absolute; top:-200; left:100; z-index: 2;">
<table border=0 cellspacing=0 cellpadding=14 width=100><tr><td bgcolor=#003399>
<a onmouseover="window.status='Ссылка 1' ;return true" HREF="java.htm" target="d">[Ссылка 1]</a><br>
<a onmouseover="window.status='Ссылка 2' ;return true" HREF="" target="d">[Ссылка 2]</a><br>
<a onmouseover="window.status='Ссылка 3' ;return true" HREF="" target="d">[Ссылка 3]</a><br>
<a onmouseover="window.status='Ссылка 4' ;return true" HREF="" target="d">[Ссылка 4]</a><br>
<a onmouseover="window.status='Ссылка 5' ;return true" HREF="" target="d">[Ссылка 5]</a><br>
<a onmouseover="window.status='Ссылка 6' ;return true" HREF="" target="d">[Ссылка 6]</a><br>
<a onmouseover="window.status='Ссылка 7' ;return true" HREF="" target="d">[Ссылка 7]</a></TD>
</tr></table>
</div><br>

<a href="javascript:do_menue()">Нажми здесь!</a>

+1

76

Само печатающийся текст в поле формы .

Код:
<html>

<head><script LANGUAGE="JavaScript">
/* 
This source code is released to the public domain with the provision that 
the copyright information remains in the source code.
Copyright (c) by: Robert N Bovara All Rights Reserved.
*/
var outMsg = "";
var i = 0;
var lineNo = 1;
var timerDM=null;
var msg = " ";
function araVob() {
}
var ScreenLine = new araVob();
ScreenLine[1] = "Doesn't this look better than status bar displays?"
ScreenLine[2] = "Isn't this easier to read than \"sideways\" scrollers?"
ScreenLine[3] = " ";
ScreenLine[4] = "How many lines can you display on the status bar?"
ScreenLine[5] = "Here, you can not only display more than one line,\f ";
ScreenLine[6] = "But, you can also display more than one \"page\" !"
ScreenLine[7] = " ";
ScreenLine[8] = "Aren't you glad your browser interprets JavaScript (JScript)?"
ScreenLine[9] = " ";
ScreenLine[10] = "Enjoy!....The JavaFILE crew...\f";
ScreenLine[11] = "P.S.\t'Tis better to have no moving text at all ....."
ScreenLine[12] = "\t... than to have a \"sideways\" scroller.";
ScreenLine[13] = " \f";
/*
To change or add messages, just replace values of or add to ScreenLine[n]
above. Each ScreenLine[n] is a separate line. To change the "page" before 
the defined page length is reached, insert a \f character at the end of the 
line where you want the break. Use \" for quotes and \t for tabs in the 
message text.
*/
var msgNum = 1; // set to first message to display
var msgCnt = 13; // set to number of last message "page" to display.
var typeSpeed = 60; // the typing rate, in milliseconds. (Higher number is slower)
var pageLen = 5; // set to page size, usually number of ROWS in TEXTAREA
var delay=typeSpeed;
var r = 0;
var cr="\r\n"
if ("3" <=navigator.appVersion.charAt(0)) {
var cr="\n"
}
for (x = 1; x<=(msgCnt); x++) {
ScreenLine[x] = ScreenLine[x] + cr;
}
msg = ScreenLine[1];

function DisplayMsg() {
if (msg.length <= i || msg.charAt(i) == "\f") {
r=i;
i=0;
ChangeMsg();
}
outMsg = outMsg + msg.charAt(i);
i++; 
if (msg.charAt(i) == "\f" || (lineNo == pageLen && i==msg.length)) {
delay = 4000; }
else {
if (msg.charAt(i) == cr && msg != " "+cr) {
delay = 2000; }
else {
delay = typeSpeed; } 
}
self.document.forms[0].elements[0].value=outMsg;
timerDM = setTimeout("DisplayMsg()",delay);
}

function ChangeMsg() {
msgNum++;
if (msgCnt < msgNum) {
msgNum = 1;
}
lineNo++;
if (pageLen < lineNo || msg.charAt(r) == "\f") {
outMsg=ScreenLine[msgNum].charAt(i);
i++;
lineNo = 1;
}
msg = ScreenLine[msgNum];
}

function quitDisplay() {
self.document.forms[0].elements[0].value = "Type yourself a Note today!";
}
// -->
</script>

<title>JavaFILE</title>
<base target="leftframe">
</head>

<body onLoad="DisplayMsg()" ; onUnload="quitDisplay()">

<p align="center"> </p>

<form NAME="msgform" ACTION>
<p><textarea NAME="msgarea" COLS="80" ROWS="5"> 
JavaScript (or JScript) Power needed.

0

77

Генератор таблц, в HTML-низ

Код:
<script language="JavaScript1.2">
<!--
var ns6=document.getElementById&&!document.all?1:0

var head="display:''"
var folder=''

function expandit(curobj){
folder=ns6?curobj.nextSibling.nextSibling.style:document.all[curobj.sourceIndex+1].style
if (folder.display=="none")
folder.display=""
else
folder.display="none"
}

//-->
</script>
<SCRIPT language=JavaScript>
<!--
function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
  function InsSM()
   {
   var table = '[table'+document.all.Bgcolor.value+document.all.Dkcolor.value+document.all.Ltcolor.value+']';

  for (var x=0; x<document.all.rows.value; x++) {
    table += "[tr]";
    for (var y=0; y<document.all.cols.value; y++) {
      table += "[td]Ячейка[/td]";
    }
    table += "[/tr]";
  }
  table += "[/table]\n";
    document.all.theCode.value=(table);
document.write('<b><font size=2 color=#555555 face=Arial, Helvetica, sans-serif>Скопируйте эти теги в ваше сообщение</font></b><br><textarea name=theCode cols=50 rows=6>'+table+'</textarea><br><input type=button name=Button value=Выделить onClick=document.all.theCode.select();document.all.theCode.focus()><br><br><br>');
document.write('<p><input type=button name=button value=Назад onClick=history.back()></p><Br><br>.');


}

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_showHideLayers() { 
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
</SCRIPT>
<h4 style='cursor:hand' onClick='expandit(this)'>Сделать таблицу</h3>
<TABLE width=300 style='display:none' style=&{head};>
  <TR>
    <TD>Строк: <INPUT maxLength=3 size=3 value=1 name=rows></TD>
    <TD>Ячеек: <INPUT maxLength=4 size=3 value=1 name=cols></TD>
    <td><INPUT type=hidden name=Bgcolor><INPUT type=hidden name=Dkcolor><INPUT type=hidden name=Ltcolor></td>
    <TD colSpan=4><BR><INPUT type=hidden name=theCode> <INPUT onclick=InsSM() type=button value="Создать" name=Button2></TD>
</TR>
</TABLE>

0

78

Вместо нмоера ICQ высвечивается картинка, при клике показывает сам номер.

Код:
<script type="text/javascript">
var arr=document.getElementsByTagName("li")
i=0
str=document.URL
while(arr[i] ){
if(arr[i].className=="pa-icq"){
name=arr[i].innerHTML
name=name.substring(5)
arr[i].innerHTML="<a style=\"cursor: pointer;\" onclick=\"prompt('Номер ICQ', '"+name+"')\" title='Кликните, чтобы посмотреть номер'>ICQ#</a>"
}
i++
}
</script>

0

79

Хвост из снежинок за курсором

<body bgcolor="silver" text="white" link="white" vlink="white">

<DIV ID=dot0
STYLE="HEIGHT: 15px; POSITION: absolute; VISIBILITY: hidden; WIDTH: 15px">
<DD><IMG BORDER=0 HEIGHT=15 SRC="sneg.gif" WIDTH=15>
</DD></DIV>
<DIV ID=dot1 STYLE="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px">
<DD><IMG BORDER=0 HEIGHT=15 SRC="sneg.gif" WIDTH=15>
</DD></DIV>
<DIV ID=dot2 STYLE="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px">
<DD><IMG BORDER=0 HEIGHT=15 SRC="sneg.gif" WIDTH=15>
</DD></DIV>
<DIV ID=dot3 STYLE="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px">
<DD><IMG BORDER=0 HEIGHT=15 SRC="sneg.gif" WIDTH=15>
</DD></DIV>
<DIV ID=dot4 STYLE="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px">
<DD><IMG BORDER=0 HEIGHT=15 SRC="sneg.gif" WIDTH=15>
</DD></DIV>
<DIV ID=dot5 STYLE="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px">
<DD><IMG BORDER=0 HEIGHT=15 SRC="sneg.giff" WIDTH=15>
</DD></DIV>
<DIV ID=dot6 STYLE="HEIGHT: 15px; POSITION: absolute; WIDTH: 15px">
<DD><IMG BORDER=0 HEIGHT=15 SRC="sneg.gif" WIDTH=15>
</DD></DIV>
<SCRIPT LANGUAGE=JavaScript>
<!-- hide code

var nDots = 7;

var Xpos = 0;
var Ypos = 0;

var DELTAT = .01;
var SEGLEN = 10;
var SPRINGK = 10;
var MASS = 1;
var GRAVITY = 50;
var RESISTANCE = 10;
var STOPVEL = 0.1;
var STOPACC = 0.1;
var DOTSIZE = 10;
var BOUNCE = 0.75;
var isNetscape = navigator.appName=="Netscape";
var followmouse = true;

init();

function init()
{
var i = 0;
dots = new Array();
for (i = 0; i < nDots; i++) {
  dots[i] = new dot(i);
}

if (!isNetscape) {

  setInitPositions()
}

for (i = 0; i < nDots; i++) {
  dots[i].obj.left = dots[i].X;
  dots[i].obj.top = dots[i].Y;
}

   
if (isNetscape) {

  startanimate();
} else {

  setTimeout("startanimate()", 3000);
}
}

function dot(i)
{
this.X = Xpos;
this.Y = Ypos;
this.dx = 0;
this.dy = 0;
if (isNetscape) {
  this.obj = eval("document.dot" + i);
} else {
  this.obj = eval("dot" + i + ".style");
}
}

function startanimate() {
setInterval("animate()", 20);
}

function setInitPositions()
{
var startloc = document.all.tags("LI");
var i = 0;
for (i = 0; i < startloc.length; i++) {
  dots[i+1].X = startloc[i].offsetLeft +
     startloc[i].offsetParent.offsetLeft;
  dots[i+1].Y = startloc[i].offsetTop +
     startloc[i].offsetParent.offsetTop +
     DOTSIZE/2;
}
dots[0].X = dots[1].X;
dots[0].Y = dots[1].Y - SEGLEN;
}
 
function MoveHandler(e)
{
Xpos = e.pageX;
Ypos = e.pageY;   
return true;
}

function MoveHandlerIE() {
  Xpos = window.event.x;
  Ypos = window.event.y;   
}

if (isNetscape) {
document.captureEvents(Event.MOUSEMOVE);
document.onMouseMove = MoveHandler;
} else {
document.onmousemove = MoveHandlerIE;
}

function vec(X, Y)
{
this.X = X;
this.Y = Y;
}

function springForce(i, j, spring)
{
var dx = (dots[i].X - dots[j].X);
var dy = (dots[i].Y - dots[j].Y);
var len = Math.sqrt(dx*dx + dy*dy);
if (len > SEGLEN) {
  var springF = SPRINGK * (len - SEGLEN);
  spring.X += (dx / len) * springF;
  spring.Y += (dy / len) * springF;
}
}

function animate() {
var start = 0;
if (followmouse) {
  dots[0].X = Xpos;
  dots[0].Y = Ypos;
  start = 1;
}

for (i = start ; i < nDots; i++ ) {

  var spring = new vec(0, 0);
  if (i > 0) {
   springForce(i-1, i, spring);
  }
  if (i < (nDots - 1)) {
   springForce(i+1, i, spring);
  }

  var resist = new vec(-dots[i].dx * RESISTANCE,
        -dots[i].dy * RESISTANCE);

  var accel = new vec((spring.X + resist.X)/ MASS,
       (spring.Y + resist.Y)/ MASS + GRAVITY);
 
       dots[i].dx += (DELTAT * accel.X);
  dots[i].dy += (DELTAT * accel.Y);
 
  if (Math.abs(dots[i].dx) < STOPVEL &&
      Math.abs(dots[i].dy) < STOPVEL &&
      Math.abs(accel.X) < STOPACC &&
   Math.abs(accel.Y) < STOPACC) {
    dots[i].dx = 0;
    dots[i].dy = 0;
  }

  dots[i].X += dots[i].dx;
  dots[i].Y += dots[i].dy;

  var height, width;
  if (isNetscape) {
      height = window.innerHeight;
      width = window.innerWidth;
  } else {
      height = document.body.clientHeight;
      width = document.body.clientWidth;
  }

  if (dots[i].X < 0) {
   if (dots[i].dx < 0) {
    dots[i].dx = BOUNCE * -dots[i].dx;
   }
   dots[i].X = 0;
  }

  dots[i].obj.left = dots[i].X;   
  dots[i].obj.top =  dots[i].Y; 
}
}

// --></SCRIPT>

Красное заменить на свое

0

80

Отредактируйте сообщение и нажмите отправить

Отредактировано VladimirI (2010-02-09 01:49:51)

0


Вы здесь » КомПик » Скрипты/Шаблоны » Большой сборник скриптов для Форумов и Сайтов