Автосмена баннеров

 

<script language="Javascript">
<!--
// original content taken from Nic's JavaScript Page with permission
// lack of these three lines will result in copyright infringment
// made by: Nic's JavaScript Page - http://www.javascript-page.com

var currentdate = 0;
var core = 0;

function initArray() {

this.length = initArray.arguments.length;
  for (var i = 0; i < this.length; i++) {
  this[i] = initArray.arguments[i];
  }
}

link = new initArray(
"http://3bgraphics.hypermart.net/",
"http://html.digitalsea.net/",
"http://www.javascript-page.com/"
);

image = new initArray(
"http://3bgraphics.hypermart.net/link/3bgraphics.gif",
"http://html.digitalsea.net/htmlnow.gif",
"http://www.geocities.com/~jsmaster/jsnow.gif"
);

text = new initArray(
"3B Graphics",
"Learn HTML in 7 Easy Steps",
"Nic's JavaScript Page"
);

var currentdate = new Date();
var core = currentdate.getSeconds() % image.length;
var ranlink  = link[core];
var ranimage = image[core];
var rantext  = text[core];

document.write('<a href=\"' +ranlink+ '\" target=\"_blank\"><img src=\"'+ranimage+'\" border="0" alt=\"'+rantext+'\"></a>');

//-->
</SCRIPT>
Замена цвета у текста линка
<script language="Javascript1.2">
<!--
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com

var bloffon = 0;
var activated = false;
var speed = 1000;
var bltxt;

function BlinkOn() {
 window.status = (bloffon%2 == 0) ? bltxt : " ";
 bloffon++;

 if (!activated) {
  mybl = setInterval('BlinkOn()',speed);
  activated = true;
 }
}

function BlinkOut() {
 window.status = " ";
 clearInterval(mybl); 
 bloffon=0;
 activated = false;
}

// -->
</script>
<a href="" onMouseOver="bltxt='This is the Blinking Mouseover';BlinkOn();return true;" 
onMouseOut="BlinkOut()">Put your mouse over here</a> and check out the statusbar.
Линк кнопка
<script language="Javascript">
<!--
function bulinker(where) {
top.location = where
}
//-->
</script>
<form>
<input type="button" onclick="bulinker('index.html')" value="Go to the Main Page"><br>
<input type="button"onclick="bulinker('http://www.geocities.com/~jsmaster/easyhtml')" 
value="The EasyHTML Editor">
</form>
Форма с кнопкой
<FORM name="guideform">
<SELECT name="guidelinks">
<OPTION SELECTED value="http://place.com/page1.htm">Page 1
<OPTION value="http://place.com/page2.htm">Page 2
</SELECT>
&nbsp;&nbsp;
<INPUT type="button" name="go" value="Go!" onClick="window.location=document.guideform.guidelinks.options
[document.guideform.guidelinks.selectedIndex].value">
</FORM>
виды  выделения фона
 

background-color

This property will let you add a background color behind most anything. You can add it to text like this:

<SPAN style="background-color:yellow">My background is yellow!</SPAN>

And you get a beautiful yellow background.....

My background is yellow!

Also, you can use this in tables:

<TABLE style="background-color:orange" border="1">
<TD>AAAGH! Pumpkin Background!


</TABLE>

And you get the old orange background.....

AAAGH! Pumpkin Background!

And how about a form box? Of course!

<FORM>
Name: <INPUT TYPE="text" size="25" style="background-color:green">
</FORM>

Now just look at this........

 

Name:

background-image

This is the same as a background color, but it uses an image you specify instead of a color. Also, you have to write it a little differently, using a url call:

background-image:url(1.jpg)

After the colon, you write "url". Then you put the url inside a set of parentheses, with no quote marks around it. Here it is in action:

 

<SPAN style="background-image:url(1.jpg)">
Can you even read this?
</SPAN>

And we get a background that no one can read over!

Can you even read this?

And of course, the table:

<TABLE style="background-image:url(1.jpg)" border="1">
<TD>AAAGH! Can you read this?</TD>
</TABLE>

And you get the image background.....

 

AAAGH! Can you read this?

And how about a form textarea this time? Well, O.K.....

<FORM>
<TEXTAREA rows="10" cols="50" style="background-image:url(1.jpg)">
</TEXTAREA>
</FORM>

Мерцание цвета фона при загрузке
 
<script language="JavaScript">
<!--
var currentcolor = 0
function initArray(n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '
  }
}

bgcolors = new initArray(15)
bgcolors[0]="ffffff"
bgcolors[1]="ffdead"
bgcolors[2]="ffffff"
bgcolors[3]="add8e6"
bgcolors[4]="0000ff"
bgcolors[5]="add8e6"
bgcolors[6]="90ee90"
bgcolors[7]="00ff00"
bgcolors[8]="90ee90"
bgcolors[9]="ffc0cb"
bgcolors[10]="ff0000"
bgcolors[11]="ffc0cb"
bgcolors[12]="FFFFFF"
bgcolors[13]="ffdead"
bgcolors[14]="FFFFFF"

function backgroundChanger() {
document.bgColor = bgcolors[currentcolor];

if (currentcolor < bgcolors.length-1) {
currentcolor++
setTimeout("backgroundChanger()", 100);
}
}

backgroundChanger();
//-->
</script>
Перевод на другую страницу с сообщением
<script language="Javascript">
<!--
alert("You will now be taken to another location " 
       +"so you can see the source of this script");

location = "location2.html"

//-->
</script>
Форма для отправки текста по мылу
<script language="Javascript">
<!--
var YourSubject = "Check out this Site - http://www.javascript-page.com"; 

var theE, theB, newB;

function changeLoc() {
theE = document.MailForm.toemail.value;
newB = "\n" + document.MailForm.thebody.value;
theB = document.MailForm.Message.value;

if (document.RealForm.Message.value.indexOf(newB) == -1) 
  document.RealForm.Message.value =  newB + theB;
else if (document.RealForm.Message.value.indexOf(theB) == -1) 
  document.RealForm.Message.value = theB;


document.RealForm.action = "mailto:"+theE+"?subject="+YourSubject;
}

//-->
</script>
<br>
<form name="MailForm" method="get" action=" ">
<b>To: </b> <input type="text" name="toemail" size=30>
<br>
<B>Your Message:</B> <br>
<textarea name="thebody" cols="60" rows="6"></textarea>
<input type="hidden" name="Message" value="

Get tons of free javascripts for your page at Nic's JavaScript Page, 
including this recommendation form that allows your visitors to 
recommend your site to friends with the push of a button.  Just 
check out the URL below:

http://www.javascript-page.com">
<br>
</form>
<form name="RealForm" method="post" action=" " ENCTYPE="text/plain">
<input type="submit" value="Recommend Page" onmousedown="changeLoc();">
<input type="hidden" name="Message">
</form>
Перемещаемое мышкой  меню
<div id="movmenu" style="position:absolute; visibility:show; left:20px; top:20px; z-index:2">
<table border=1>
<tr><td bgcolor=#dedede>
<b>
<CENTER><font FACE="MS Sans Serif" style="color:darkblue;cursor:move;text-decoration:none;font-size:12pt">
NicNet Menu</a></b></font></CENTER>
</td></tr>
<tr><td bgcolor="#ffffff">
<br>
<a href="yoururl1.html">Your Link1</a><br>
<a href="yoururl2.html">Your Link2</a><br>
<a href="yoururl3.html">Your Link3</a><br>
<a href="yoururl4.html">Your Link4</a><br>
</td>
</tr>
<tr><td bgcolor=#dedede>
<CENTER><a href="javascript:void(0)" FACE="MS Sans Serif" 
style="color:darkred;cursor:move;text-decoration:none;font-size:10pt" 
onmousedown="InitializeMove()"><b>Click Here to Move Menu<br>Double-Click to Stop</b></FONT></CENTER>
</td></tr>
</table>
</div>
<div id="emptycell" style="position:absolute; visibility:show; left:-70px; top:-70px; z-index:2"></div>
<script language="JavaScript1.2">
<!--
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com

var XX = -70;
var YY = -70;
var cur_one = "emptycell"
var moving = false;
var xpos1 = 20;
var ypos1 = 20;
var myX = 0;
var myY = 0;

function InitializeMove() {
cur_one = "movmenu";
XX = eval("xpos1");
YY = eval("ypos1");
}

function CaptureMove() {
if (document.layers) document.captureEvents(Event.MOUSEMOVE);
}

function EndMove() {
if (document.layers) document.releaseEvents(Event.MOUSEMOVE);

cur_one = "emptycell"
moving = false;
document.close();
}

function WhileMove() {

  if (document.all) {
    eval(cur_one+".style.left="+myX);
    eval(cur_one+".style.top="+myY);
  }
  
  if (document.layers) {
    eval("document."+cur_one+".left="+myX);
    eval("document."+cur_one+".top="+myY);
  }
}

function MoveHandler(e) {

myX = (document.all) ? event.clientX : e.pageX;
myY = (document.all) ? event.clientY : e.pageY;

  if (!moving) {
    diffX =  XX - myX;
    diffY = YY - myY;
    moving = true;
  if (cur_one == "emptycell") moving = false;
}
myX += diffX;
myY += diffY;

  if (moving) {
    xpos1 = myX;
    ypos1 = myY;
  }

WhileMove();
}

function ClearError() {
return true;
}

if (document.layers) {
document.captureEvents(Event.CLICK);
document.captureEvents(Event.DBLCLICK);
}

document.onmousemove = MoveHandler;
document.onclick = CaptureMove;
document.ondblclick = EndMove;
window.onerror = ClearError;

WhileMove();
//-->
</script>
Два окна
<script>
<!--
var win3=window.open("remote2.htm","","width=300,height=30,resizable")
win3.creator=self
//-->
</script>
Запрос пароля
<SCRIPT>
function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password',' ');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == "
letmein") {
alert('You Got it Right!');
window.open('
protectpage.html');
break;
}
testV+=1;
var pass1 =
prompt('Access Denied - Password Incorrect, Please Try Again.','Password');
}
if (pass1.toLowerCase()!="password" & testV ==3)
history.go(-1);
return " ";
}
</SCRIPT>
<CENTER>
<FORM>
<input type="button" value="Enter Protected Area" onClick="passWord()">
</FORM>
</CENTER>
Кнопка открытия доп окна
<script>
<!--
function remote(){
win2=window.open("remote.htm","","width=150,height=350,scrollbars")
win2.creator=self
}
//-->
</script>
<form>
<input type="button" value="Launch remote!" onClick="remote()">
</form>
Стиль показа текста без подчеркивания
<style>
<!--
a{text-decoration:none}
//-->
</style>
Постепенно открывающееся второе окно
<script>
<!--
var mylocation="../index.html"
var winheight=100
var winsize=100
var x=5
function go(){
win2=window.open("","","scrollbars")
if (!document.layers&&!document.all){
win2.location=mylocation
return
}
win2.resizeTo(100,100)
win2.moveTo(0,0)
go2()
}
function go2(){
if (winheight>=screen.availHeight-3)
x=0
win2.resizeBy(5,x)
winheight+=5
winsize+=5
if (winsize>=screen.width-5){
win2.location=mylocation
winheight=100
winsize=100
x=5
return
}
setTimeout("go2()",50)
}
//-->
</script>
<a href="javascript:go()" onMouseover="window.status='open window';return true" onMouseout="window.status=''" >Open window</a>
Постепенно открывающееся второе окно
<SCRIPT>
if (navigator.javaEnabled()) {
var toolkit = java.awt.Toolkit.getDefaultToolkit();
var screen_size = toolkit.getScreenSize();
w = screen_size.width;
h = screen_size.height;
}
w=w-50; //erase these adjustments for making the window big as possible
h=h-150;
//change index.html to the name of the window U want to open
nw=window.open("../index.html","",'toolbar=yes,location=yes,directories=yes,menubar =yes,scrollbars=yes,status=yes,resizable=1,width='+w+',height='+h)
if (document.layers||document.all)
window.nw.moveTo(0,0) //up-left-justify
</SCRIPT>
Кнопка открытия полного окна
<script>
<!--
/*Full screen window opener script*/
function fullwin(){
window.open("../index.html","","fullscreen,scrollbars")
}
//-->
</script>
<form>
<input type="button" onClick="fullwin()" value="Open window">
</form>
Кнопка открытия полного окна
<script>
<!--
function winopen(){
var targeturl="../index.html"
newwin=window.open("","","scrollbars")
if (document.all){
newwin.moveTo(0,0)
newwin.resizeTo(screen.width,screen.height)
}
newwin.location=targeturl
}
//-->
</script>
<form>
<input type="button" onClick="winopen()" value="Open window">
</form>
При нажатии определенной буквы переход в другое окно (Н)
<script language="JavaScript1.2">
<!--
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function backhome(e){
var targeturl="http://www.wsabstract.com"
if (document.layers||document.getElementById&&!document.all){
if (e.which==104||e.which==72)
window.location=targeturl
}
else if (document.all){
if (event.keyCode==104||event.keyCode==72)
window.location=targeturl
}
}
document.onkeypress=backhome
//-->
</script>
При подводе к линку сообщение в форме
<script>
<!--
function showtip(tip){
document.tool.tip.value=tip
}
//-->
</script>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><p align="center"><strong><font face="Arial" size="3"><a
href="../javaindex.htm" onMouseover="showtip('Click here to learn JavaScript!')" onMouseout="showtip('')">JavaScript Tutorials</a> | </font><font
face="Arial"><a href="../howto/webbuild.htm" onMouseover="showtip('Wanna learn general web building!')" onMouseout="showtip('')">Web building tutorials</a> | </font><font
face="Arial" size="3"><a href="../cutpastejava.htm" onMouseover="showtip('Get free JavaScripts here!')" onMouseout="showtip('')">Free JavaScripts</a> </font></strong></td>
</tr>
<tr>
<td width="100%"><form name="tool">
<div align="center"><center><p><input type="text" name="tip"
size="69"></p>
</center></div>
</form>
</td>
</tr>
</table>
Линк с изменяемым текстом
1.HEAD

<STYLE>

.stHeadliner {font-family: lucida console, courier new, monospace;

font-size: 11pt;

font-weight: bold;

font-style: italic;

background: red;

color: white}

</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- start hide
// Delay in milliseconds for the growing headliner
growWait=90
// Delay in milliseconds for the expanding headliner
expandWait=120
// Delay in milliseconds for the scrolling headliner
scrollWait=100
// Number of characters in scrolling zone for the scrolling headliner
scrollWidth=40
// Number of lines, specify as much as you want to use
lineMax=4
lines=new Array(lineMax)
// Define the lines (Text to display, url, effect, time to wait)
lines[1]=new Line("Hello there, click here to go to my company site", "http://www.piaster.nl", Expand, 2000)
lines[2]=new Line("Read the news from all over the world, including my country", "http://www.cnn.com", Scroll, 1000)
lines[3]=new Line("Learn how to program in JavaScript!", "http://developer.netscape.com/library/documentation/index.html", Static, 2500)
lines[4]=new Line("Well, you can also email me!", "mailto:Jan_P@dds.nl?subject=The Headliner&cc=webmaster@piaster.nl", Grow, 3000)
// Some other variables (just don't change)
lineText=""
timerID=null
timerRunning=false
spaces=""
charNo=0
charMax=0
charMiddle=0
lineNo=0
lineWait=0
// Define line object
function Line(text, url, type, wait) {
    this.text=text
    this.url=url
    this.Display=type
    this.wait=wait
}
// Fill a string with n chars c
function StringFill(c, n) {
    s=""
    while (--n >= 0) {
        s+=c
    }
    return s
}
function Static() {
    document.formDisplay.buttonFace.value=this.text
    timerID=setTimeout("ShowNextLine()", this.wait)
}
function Grow() {
    lineText=this.text
    lineWait=this.wait
    charMax=lineText.length
    TextGrow()
}
function TextGrow() {
    if (charNo <= charMax) {
        document.formDisplay.buttonFace.value=lineText.substring(0, charNo)
        charNo++
        timerID=setTimeout("TextGrow()", growWait)
    }
    else {
        charNo=0
        timerID=setTimeout("ShowNextLine()", lineWait)
    }
}
function Expand() {
    lineText=this.text
    charMax=lineText.length
    charMiddle=Math.round(charMax / 2)
    lineWait=this.wait
    TextExpand()
}
function TextExpand() {
    if (charNo <= charMiddle) {
        document.formDisplay.buttonFace.value=lineText.substring(charMiddle - charNo, charMiddle + charNo)
        charNo++
        timerID=setTimeout("TextExpand()", expandWait)
    }
    else {
        charNo=0
        timerID=setTimeout("ShowNextLine()", lineWait)
    }
}
function Scroll() {
    spaces=StringFill(" ", scrollWidth)
    lineText=spaces+this.text
    charMax=lineText.length
    lineText+=spaces
    lineWait=this.wait
    TextScroll()
}
function TextScroll() {
    if (charNo <= charMax) {
        document.formDisplay.buttonFace.value=lineText.substring(charNo, scrollWidth+charNo)
        charNo++
        timerID=setTimeout("TextScroll()", scrollWait)
    }
    else {
        charNo=0
        timerID=setTimeout("ShowNextLine()", lineWait)
    }
}
function StartHeadliner() {
    StopHeadliner()
    timerID=setTimeout("ShowNextLine()", 1000)
    timerRunning=true
}
function StopHeadliner() {
    if (timerRunning) {
        clearTimeout(timerID)
        timerRunning=false
    }
}
function ShowNextLine() {
    (lineNo < lineMax) ? lineNo++ : lineNo=1
    lines[lineNo].Display()
}
function GotoUrl(url)
{
    top.location.href="tppmsgs/msgs4.htm#481" tppabs="http://wsabstract.com/script/url"
}
// end hide -->
</SCRIPT>
2. BODY

<center>
<form name="formDisplay">
<input class="stHeadLiner" type="button" name="buttonFace" value="** The Headliner +++ Jan Pijnacker **" onClick="GotoUrl(lines[lineNo].url)"></INPUT>
</form>
</center>
<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://wsabstract.com">Website
Abstraction</a></font></p>

При подводе к линку переход
<a href="http://www.wsabstract.com" onMouseover="window.location=this.href">Click here to go back home!</a>
Динамическое изменение рисунчатого фона
<script>
var backgr1="301.gif"
var backgr2="302.gif"
var backgr3="301.gif"
var cur=Math.round(6*Math.random())
if (cur<=1)
backgr=backgr1
else if (cur<=4)
backgr=backgr2
else
backgr=backgr3
document.write('<body background="'+backgr+'" bgcolor="#FFFFFF">')
</script>
Скрипт  открытия нового окна по дню месяца
<script>
var daylinks=new Array()
/*
Enter the 31 urls below you wish to go to for each day of the month. Note that if the current month contains less than 31 days, then some of the urls will simply not be used
*/

daylinks[1]="http://www.cnn.com"
daylinks[2]="http://www.abcnews.com"
daylinks[3]="http://www.cnet.com"
daylinks[4]="http://www.geocities.com"
daylinks[5]="http://www.lycos.com"
daylinks[6]="http://www.infoseek.com"
daylinks[7]="http://www.hotbot.com"
daylinks[8]="http://www.tripod.com"
daylinks[9]="http://www.wsabstract.com"
daylinks[10]="http://www.wired.com"
daylinks[11]="http://www.download.com"
daylinks[12]="http://www.windows95.com"
daylinks[13]="http://www.shareware.com"
daylinks[14]="http://www.builder.com"
daylinks[15]="http://www.htmlgoodies.com"
daylinks[16]="http://www.webreference.com"
daylinks[17]="http://www.webdeveloper.com"
daylinks[18]="http://www.developer.com"
daylinks[19]="http://www.news.com"
daylinks[20]="http://www.techweb.com"
daylinks[21]="http://www.zdnet.com"
daylinks[22]="http://www.excite.com"
daylinks[23]="http://www.nba.com"
daylinks[24]="http://www.microsoft.com"
daylinks[25]="http://www.netscape.com"
daylinks[26]="http://www.amazon.com"
daylinks[27]="http://www.xml.com"
daylinks[28]="http://www.espn.com"
daylinks[29]="http://www.nbc.com"
daylinks[30]="http://www.cbs.com"
daylinks[31]="http://www.hotwired.com"

var mydate=new Date()
var today=mydate.getDate()
</script>

<a href="today.htm" onClick="window.location=daylinks[today];return false">Click here for today's featured site!</a>
Фон страницы в зависимости от времени дня
<script>
<!--
var now = new Date();
var hours = now.getHours();
var psj=0;
//18-19 night
if (hours > 17 && hours < 20){
document.write('<body bgcolor="orange" text="#FFFFFF">')
}
//20-21 night
if (hours > 19 && hours < 22){
document.write('<body bgcolor="orangered" text="#FFFFFF">')
}

//22-4 night
if (hours > 21 || hours < 5){
document.write('<body bgcolor="black" text="#FFFFFF">')
}

//9-17 day
if (hours > 8 && hours < 18){
document.write('<body bgcolor="deepskyblue" text="#FFFFFF">')
}

//7-8 day
if (hours > 6 && hours < 9){
document.write('<body bgcolor="skyblue" text="#FFFFFF">')
}

//5-6 day
if (hours > 4 && hours < 7){
document.write('<body bgcolor="steelblue" text="#FFFFFF">')
}


//-->
</script>
 

Copyright © 2001 bogolubow@narod.ru BYN., ALL RIGHTS RESERVED
SE@RCHER BYN  logo are registered trademarks  Online in RuNet
 Last Updated:  Oct 10, 2001