PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : fade.js einbinden


Black Ace
08.08.2003, 16:54
ich möchte gerne ne java script nicht immer in jede html file mit rein schreiben da hab ich malne js datei gemacht namens fade.js
<html>
<head>
<title>Cold-Space</title>
<style type="text/css" src="fade.js">
BODY {
scrollbar-3d-light-color: #FFFFFF;
scrollbar-arrow-color: #FFFFFF;
scrollbar-base-color: #FFFFFF;
scrollbar-dark-shadow-color: #FFFFFF;
scrollbar-face-color: #000000;
scrollbar-highlight-color: #000000;
scrollbar-shadow-color: #FFFFFF;
}
A:link, A:visited, A:active { text-decoration:none; COLOR: #ff0000; }
A:hover { Text-Decoration :none; COLOR: #DDDDFF; }
</style>
</head>
<body bgcolor="#000000" link="#FFFFFF" alink="#FFFFFF" vlink="#FFFFFF">
<script type="text/javascript" src="fade.js">
</script>
<font color="#FFFFFF">
<br>
<br>
<table align="center" width="90%" bgproperties="fixed" style="BORDER: #005090 1px solid; COLOR: #FFFFFF; BACKGROUND-COLOR: #000000;">
<tr><td align="center"><font color="#FFFFFF" size="2" face="Arial" valign=top align=center>
<b>Freespace 1/2 Tools:</b><br><br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/anib32b1.exe" onMouseOver="window.status=msg;return true" onmouseover="findLink(this.id); onmouseout="clearFade();>AniBuilder</a> - Lets you create the FS/FS2 animations.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/FS2AFSB.zip" onMouseOver="window.status=msg;return true">Ani Sequence Builder</a> - Create files with the correct sequence numbers used for making .ani files.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/aniview11.exe" onMouseOver="window.status=msg;return true">AniView</a> - Let's you view the in-game FS/FS2 animations.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/FS2MBU.zip" onMouseOver="window.status=msg;return true">FS2 Background Creator</a> - Makes FS2 backgrounds for you.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/modv32b3.exe" onMouseOver="window.status=msg;return true">ModelView</a> - View and analyze FS and FS2 models, plus Descent 2 and 3 models.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/pil32b1b.exe" onMouseOver="window.status=msg;return true">PilotView</a> - View your single and multiplayer stats for FS/FS2.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/tblv32b1.exe" onMouseOver="window.status=msg;return true">TableView</a> - View the contents of FS/FS2 tables in a neat fashion.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/VPCS.zip" onMouseOver="window.status=msg;return true">VP Constructor</a> - Makes FS2 VP files for campaigns/mods.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/vpvw20b2.exe" onMouseOver="window.status=msg;return true">VPView V2.0</a> - Beta update to the original VP View. Offers more features, but isn't as stable as VPView.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/fskit02d.exe" onMouseOver="window.status=msg;return true">Freespace Kit</a> - Contains stable versions of VPView, ANIView, FSMView, TBLView, CampEdit, and PilotView.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/dp2003.exe" onMouseOver="window.status=msg;return true">DLL Pack</a> - Required DLL files to run all of the Descent-Network tools.
<hr color=#005090 width="90%">
</td></tr>
<tr><td align="center"><b>Freespace 2 Files:</b><br><br>
<a href="http://www.the-underdogs.org/game.php?id=4150" onMouseOver="window.status=msg;return true">Freespace 2</a> - Download the full version of Freespace 2.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/fs21x-12.exe" onMouseOver="window.status=msg;return true">Freespace 2 Patch</a> - Updates Freespace 2 to version 1.2.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/FS2Trailer1-lo.zip" onMouseOver="window.status=msg;return true">FS2 Trailer Low Res</a> - Watch the FS2 trailer, in all it's glory.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/FS2trailer1.zip" onMouseOver="window.status=msg;return true">FS2 Trailer High Res</a> - Watch the FS2 trailer, in all it's glory.<br>
</font>
<hr color=#005090 width="90%">
</td></tr>
<tr><td align="center"><b>Freespace 2 Mods:</b><br>
<hr color=#005090 width="90%">
<u>Ships:</u><br><br>
<a href="http://www.descent.dk/hunter/f2s/mods/SBvindhyachalRev1.zip" onMouseOver="window.status=msg;return true" title="Download SB Vindhyachal - By Robin Varley">SB Vindhyachal</a> - New shivan-bomber, with a additional tech-description from Su-Tehp.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/fs21x-12.exe" onMouseOver="window.status=msg;return true" title="Download GTCv Nike - by PSYCHO">GTVc Nike</a> - Experimental corvette gun-boat.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/FS2Trailer1-lo.zip" onMouseOver="window.status=msg;return true">FS2 Trailer Low Res</a> - Watch the FS2 trailer, in all it's glory.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/FS2trailer1.zip" onMouseOver="window.status=msg;return true">FS2 Trailer High Res</a> - Watch the FS2 trailer, in all it's glory.<br>
</font>
<hr color=#005090 width="90%">
</td></tr>
<tr><td align="center">
<u>Weapons:</u><br><br>
<a href="http://www.descent.dk/hunter/f2s/mods/SBvindhyachalRev1.zip" onMouseOver="window.status=msg;return true">SB Vindhyachal</a> - New shivan-bomber, with a additional tech-description from Su-Tehp.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/fs21x-12.exe" onMouseOver="window.status=msg;return true">GTVc Nike</a> - Experimental corvette gun-boat.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/FS2Trailer1-lo.zip" onMouseOver="window.status=msg;return true">FS2 Trailer Low Res</a> - Watch the FS2 trailer, in all it's glory.<br>
<a href="http://dl.fileplanet.com/dl/dl.asp?3dactionplanet/freespace/FS2trailer1.zip" onMouseOver="window.status=msg;return true">FS2 Trailer High Res</a> - Watch the FS2 trailer, in all it's glory.<br>
</font>
</td></tr>
</table>
<p></p>
</font>
</body>
</html>

damit hab ich probiert die datei einzufügen <script type="text/javascript" src="fade.js">
</script>

geht aber net was ist falsch wenn ich das java script so in dder html file mit drin hab funzen die effekte prima ??

Mystics
08.08.2003, 17:14
Normalerweise bindet man es so ein:<script type="text/javascript" language="javascript" src="fade.js"></script>Wie sieht denn deine fade.js aus?

Da darf z.B. "<script language="javascript">" etc. nicht drinstehen, sondern nur die function(s) ().

Black Ace
08.08.2003, 17:20
jo danke funzt jetzt ich hatte in der fade.js mit das ""<script language="javascript">" drin fals du den code sehen willst hierfunction SymError()
{
return true;
}

window.onerror = SymError;

var msg="";

startColor = "#ff0000"; // initial link color
endColor = "#DDDDFF"; // final link color


stepIn = 25; // delay when fading in
stepOut = 25; // delay when fading out

autoFade = true;

sloppyClass = false;


hexa = new makearray(16);
for(var i = 0; i < 10; i++)
hexa[i] = i;
hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
hexa[13]="d"; hexa[14]="e"; hexa[15]="f";

document.onmouseover = domouseover;
document.onmouseout = domouseout;

startColor = dehexize(startColor.toLowerCase());
endColor = dehexize(endColor.toLowerCase());

var fadeId = new Array();

function dehexize(Color){
var colorArr = new makearray(3);
for (i=1; i<7; i++){
for (j=0; j<16; j++){
if (Color.charAt(i) == hexa[j]){
if (i%2 !=0)
colorArr[Math.floor((i-1)/2)]=eval(j)*16;
else
colorArr[Math.floor((i-1)/2)]+=eval(j);
}
}
}
return colorArr;
}

function domouseover() {
if(document.all){
var srcElement = event.srcElement;
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
fade(startColor,endColor,srcElement.uniqueID,stepIn);
}
}

function domouseout() {
if (document.all){
var srcElement = event.srcElement;
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
fade(endColor,startColor,srcElement.uniqueID,stepOut);
}
}

function makearray(n) {
this.length = n;
for(var i = 1; i <= n; i++)
this[i] = 0;
return this;
}

function hex(i) {
if (i < 0)
return "00";
else if (i > 255)
return "ff";
else
return "" + hexa[Math.floor(i/16)] + hexa[i%16];}

function setColor(r, g, b, element) {
var hr = hex(r); var hg = hex(g); var hb = hex(b);
element.style.color = "#"+hr+hg+hb;
}

function fade(s,e, element,step){
var sr = s[0]; var sg = s[1]; var sb = s[2];
var er = e[0]; var eg = e[1]; var eb = e[2];

if (fadeId[0] != null && fade[0] != element){
setColor(sr,sg,sb,eval(fadeId[0]));
var i = 1;
while(i < fadeId.length){
clearTimeout(fadeId[i]);
i++;
}
}

for(var i = 0; i <= step; i++) {
fadeId[i+1] = setTimeout("setColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" +
step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+
")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");",i*step);
}
fadeId[0] = element;
}