Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JavaScript] Wywoływanie skryptu
Forum PHP.pl > Forum > Przedszkole
obelix94
Posiadam kilka skryptów JavaScript. Proszę was o pomoc w napisaniu kodu do ich wywołania.

Kod
<script LANGUAGE="JavaScript1.2">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! [url="http://javascript.internet.com"]http://javascript.internet.com[/url] -->

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

var ctext = "Wow! Look at all the pretty colors! ;-)";
var speed = 1000;
var x = 0;
var color = new initArray(
"red", 
"blue", 
"green",
"black"
);
if(navigator.appName == "Netscape") {
document.write('<layer id="c"><center>'+ctext+'</center></layer><br>');
}
if (navigator.appVersion.indexOf("MSIE") != -1){
document.write('<div id="c"><center>'+ctext+'</center></div>');
}
function chcolor(){ 
if(navigator.appName == "Netscape") {
document.c.document.write('<center><font color="'+color[x]);
document.c.document.write('">'+ctext+'</font></center>');
document.c.document.close();
}
else if (navigator.appVersion.indexOf("MSIE") != -1){
document.all.c.style.color = color[x];
}
(x < color.length-1) ? x++ : x = 0;
}
setInterval("chcolor()",1000);
// End -->
</script>



Kod
<script LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! [url="http://javascript.internet.com"]http://javascript.internet.com[/url] -->
<!-- Original:  Premshree Pillai (premshree@hotmail.com ) -->
<!-- Web Site:  [url="http://www.qiksearch.com"]http://www.qiksearch.com[/url] -->
<!-- Begin

window.onerror = null;
 var bName = navigator.appName;
 var bVer = parseInt(navigator.appVersion);
 var NS4 = (bName == "Netscape" && bVer >= 4);
 var IE4 = (bName == "Microsoft Internet Explorer" 
 && bVer >= 4);
 var NS3 = (bName == "Netscape" && bVer < 4);
 var IE3 = (bName == "Microsoft Internet Explorer" 
 && bVer < 4);
 var blink_speed=100;
 var i=0;
 
if (NS4 || IE4) {
 if (navigator.appName == "Netscape") {
 layerStyleRef="layer.";
 layerRef="document.layers";
 styleSwitch="";
 }else{
 layerStyleRef="layer.style.";
 layerRef="document.all";
 styleSwitch=".style";
 }
}

//BLINKING
function Blink(layerName){
 if (NS4 || IE4) { 
 if(i%2==0)
 {
 eval(layerRef+'["'+layerName+'"]'+
 styleSwitch+'.visibility="visible"');
 }
 else
 {
 eval(layerRef+'["'+layerName+'"]'+
 styleSwitch+'.visibility="hidden"');
 }
 } 
 if(i<1)
 {
 i++;
 } 
 else
 {
 i--
 }
 setTimeout("Blink('"+layerName+"')",blink_speed);
}
//  End -->
</script>


Kod
<script LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! [url="http://javascript.internet.com"]http://javascript.internet.com[/url] -->
<!-- Ken Tholke, kentholke@firstsaga.com. -->

<!-- Begin
// add as many or as few messages as you would like
var msg=new Array()
msg[0]="<CENTER>You can see more scripts like this one...</CENTER>";
msg[1]="<CENTER>...when you visit the JavaScript Source.</CENTER>";
msg[2]="<CENTER>Just type in \"<A href='http://javascript.internet.com/'>javascript.internet.com</A>\"</CENTER>";
msg[3]="<CENTER>Your computer can handle the rest.</CENTER>";

// set your first set of colors.  Use as many or as few as you wish.
var colors1=new Array("ffffff", "eeeeff", "ddddff", "ccccff", "bbbbff", "aaaaff", "9999ff",
"8888ff", "7777ff", "6666ff", "5555ff", "4444ff", "3333ff","2222ff", "1111ff", "0000ff")

//set your second set of colors
// *** must have exactly the same number of colors as the array above ***
var colors2=new Array("ffffff", "ffeeee", "ffdddd", "ffcccc", "ffbbbb", "ffaaaa", "ff9999",
"ff8888", "ff7777", "ff6666", "ff5555", "ff4444", "ff3333", "ff2222", "ff1111", "ff0000")

//set the height of the display in pixels
high=60;

//set the width of the display in pixels
wide=350;

//set the pixel coordinates for the upper left hand corner of the display
Xpos=220;
Ypos=180;

// move the display away from the edges of the background
pad=15;

// set the background color of the display
bgcol="ffffff";

//add a background image if you want.
// *** for no image, just leave empty quotes (ex. cellbg=""; ) ***
cellbg="faderbg.jpg";

// set the font
fntFam="verdana,helvetica,arial";
fntSize=14;

// set how how many seconds you want the message to stay remain at totality.
pause=2.5;


// Do not edit these values below!!!

icolor=0;
mcolor=1;
imsg=0;
spWidth=wide-(2*pad);
totality=false;
glowing=true;
var theMsg="";
var cellcontent="";
pause=pause*1000;
if(cellbg.length>4){cellbg=" background="+cellbg}
else{cellbg="";}

function doPause(){
   totality=false; t=setTimeout("changecolor()",pause);
   }
function initiate(){
   getContentColor();
   getMsg();
   getCellContent();
   if(document.all){
   msgbg.innerHTML=cellcontent;
   msgfade.innerHTML=theMsg;
   msgbg.style.posLeft=Xpos;
   msgbg.style.posTop=Ypos;
   msgfade.style.posLeft=Xpos+pad;
   msgfade.style.posTop=Ypos+pad;
   t=setTimeout("changecolor()",50);}
   if(document.layers){
   document.msgbg.document.write(cellcontent);
   document.msgbg.document.close();
   document.msgfade.document.write(theMsg);
   document.msgfade.document.close();
   document.msgbg.left=Xpos;
   document.msgbg.top=Ypos;
   document.msgfade.left=Xpos+pad;
   document.msgfade.top=Ypos+pad;
   t=setTimeout("changecolor()",100);}
   }
function changecolor(){
   if(totality==true){doPause();}
   else{
   getMsg();
   getContentColor();
   if(document.all){
   msgfade.innerHTML=theMsg;
   t=setTimeout("changecolor()",50);}
   if(document.layers){
   document.msgfade.document.write(theMsg);
   document.msgfade.document.close();
   t=setTimeout("changecolor()",70);}
   }
   }
function getFadeColor(){
   icolor=icolor-1;
   if(mcolor==1){contentcolor=colors1[icolor];}
   else{contentcolor=colors2[icolor];}
   }
function getGlowColor(){
   icolor=icolor+1;
   if(mcolor==1){contentcolor=colors1[icolor];}
   else{contentcolor=colors2[icolor];}
   }
function changemsg(){
   if(imsg==msg.length-1){imsg=0; mcolor=1;}
   else if(imsg != msg.lenght-1 && mcolor==1){imsg=imsg+1; mcolor=0;}
   else{imsg=imsg+1; mcolor=1;}
   }
function getContentColor(){
   if(icolor==colors1.length-1 && glowing==true){
   getFadeColor(); glowing=false; totality=true;}
   else if(icolor < colors1.length && glowing==true){
   getGlowColor();}
   else if(icolor < 1 && glowing==false){changemsg(); getGlowColor(); glowing=true;}
   else{getFadeColor();}
   }
function getMsg() {
   theMsg="<span style='font-size:"+fntSize+"pt; font-family:"+fntFam+"; width:"+spWidth+";'>"
   theMsg+="<B><font color="+contentcolor+">"+msg[imsg]+"</font></B> "
   theMsg+="</span>"
   }
function getCellContent(){
   cellcontent="<TABLE height="+high+
   " width="+wide+" bgcolor="+bgcol+" cellpadding=0 cellspacing=0><TR><TD"+cellbg+"> </TD></TR></TABLE>"}
//  End -->
</script>
batman
1. Proszę poprawić bbcode.
2. Proszę przeczytać dokumentację do tych skryptów. Znajdziesz ją tam, skąd je ściągnąłeś.
obelix94
Sciągnąłem je ze strony skryptoteka.pl ale tam jest tylko opis skryptów.
batman
Cytat(obelix94 @ 7.12.2008, 11:12:52 ) *
Sciągnąłem je ze strony skryptoteka.pl ale tam jest tylko opis skryptów.

Opis czyli co? Nazwa i autor? Podaj linka do tych skryptów to się zobaczy, czy nie ma sposobu użycia.
obelix94
Opis czyli opis skryptu. Np. "Skrypt wyświetlajacy daną godzinę.", "Efekt tekstu polegający na mruganiu." itp.

Przykładowa podstrona: http://javascript.skryptoteka.pl/scripts.p...y=20&page=1
batman
Podaj linka bezpośrednio do pliku zip. Nie mogę znaleźć tych skryptów.
erix
A czytasz czasami komentarze w kodzie?
Cytat
<!-- ONE STEP TO INSTALL TEXT BLINKER:

1. Copy the coding into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the BODY of your HTML document -->

Cytat
<!-- TWO STEPS TO INSTALL BLINKING TEXT:

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
batman
Skrypt 1, 2 - działa w IE. W Fx wywala błąd.
Skrypt 3 działa w IE i Fx.

Poza tym ~erix ma rację. Wszystko jest napisane w skrypcie. Czyli jak zainstalować i jak używać.
obelix94
Czytałem, ale nie widząc niczego (oprócz linków) pomyslałem że ten skrypt nie posiada przykłądu. Inne miały. Stosowałem Operę. Dzieki.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.