bestof is doch latte les mal oben da steht das ich die hier ausm forum rüberkopier *rofl*achja und das nervt wenn jetzt jeder schreibt eh das is mein script....also wenne ken script oda was sinnvolles hierreinschreibst lass es doch bitte einfach sein das is nur verwirrend.
Monatskalender <script language="JavaScript">
<!--
var date=new Date();
var dd=date.getDate();
var mm=date.getMonth();
var yy=date.getYear();
if(yy < 1900)yy+=1900;
document.write("<font size=+2>Kalender für ", mm+1, ".", yy, "</font><br>");
//Wochentag des 1. des Monats ermitteln
date.setDate(1);
var kk=date.getDay();
if(kk == 0)kk=7;
document.write("<table border>");
document.write("<tr><th>Mo<th>Di<th>Mi<th>Do<th>Fr<th>Sa<th>So</tr>");
document.write("<tr>");
//erste Zeile auffuellen
for(var ii=1; ii<kk; ii++) {
document.write("<td>");
}
for(ii=1; ii<32; ii++) {
date.setDate(ii);
if(date.getMonth() != mm)break;
if(ii == dd) {
//den aktuellen Tag fett
document.write("<td><b>", ii, "</b>");
} else {
document.write("<td>",ii);
}
kk++;
if(kk > 7) {
document.write("</tr>\n<tr>");
kk=1;
}
}
document.write("</tr>\</table>");
//-->
</script>
--------------------------------------------------------------------
ne kleine rechen aufgabe =) 3 Schafe haben 12 Beine
<script language="JavaScript">
<!--
var anzahl;
var name="Schafe";
anzahl=3;
var beine=4*anzahl;
var satz=anzahl+" "+name+" haben "+beine+" Beine";
document.write(satz);
//-->
</script>
--------------------------------------------------------------------
Aktuelles Datum/Uhrzeit <body onLoad="odat=new Date();" onUnload="ndat=new Date();
var delta=Math.round((ndat.getTime() - odat.getTime())/1000.);
alert('Sie waren '+delta+' Sekunden auf dieser Seite');" >
...
<script language="JavaScript">
<!--
var date=new Date();
var dd=date.getDate();
var mm=date.getMonth() + 1;
var yy=date.getYear() % 100;
var HH=date.getHours();
var MM=date.getMinutes();
if(dd<10)dd="0"+dd;
if(mm<10)mm="0"+mm;
if(yy<10)yy="0"+yy;
if(HH<10)HH="0"+HH;
if(MM<10)MM="0"+MM;
document.write(dd+"."+mm+"."+yy+" "+HH+":"+MM);
//-->
</script>
---------------------------------------------------------------------
Taschenrechner <script language="JavaScript">
<!--
string="";
function app(cc) {
string+=cc;
document.form1.text1.value=string;
}
function cclear() {
string="";
document.form1.text1.value=string;
}
function calc() {
if(string.length > 0) {
inp="out="+string;
eval(inp);
} else {
out="0";
}
document.form1.text1.value=out;
string=""+out;
}
function upda() {
string=""+document.form1.text1.value;
}
//-->
</script>
</head>
<body onLoad="cclear()">
<form name="form1" method="POST" onSubmit="{upda(); calc(); return false;}">
<table border>
<tr><td colspan=5><input type="text" size=16 maxlength=80 name="text1" value="" onChange="upda()"></tr>
<tr>
<td align=center><input type="button" value=" 7 " onClick="app('7')">
<td align=center><input type="button" value=" 8 " onClick="app('8')">
<td align=center><input type="button" value=" 9 " onClick="app('9')">
<td align=center><input type="button" value=" / " onClick="app('/')">
<td align=center><input type="button" value=" C " onClick="cclear()">
</tr><tr>
<td align=center><input type="button" value=" 4 " onClick="app('4')">
<td align=center><input type="button" value=" 5 " onClick="app('5')">
<td align=center><input type="button" value=" 6 " onClick="app('6')">
<td align=center><input type="button" value=" * " onClick="app('*')">
<td align=center><input type="button" value=" ( " onClick="app('(')">
</tr><tr>
<td align=center><input type="button" value=" 1 " onClick="app('1')">
<td align=center><input type="button" value=" 2 " onClick="app('2')">
<td align=center><input type="button" value=" 3 " onClick="app('3')">
<td align=center><input type="button" value=" - " onClick="app('-')">
<td align=center><input type="button" value=" ) " onClick="app(')')">
</tr><tr>
<td align=center><input type="button" value=" 0 " onClick="app('0')">
<td>
<td align=center><input type="button" value=" . " onClick="app('.')">
<td align=center><input type="button" value=" + " onClick="app('+')">
<td align=center><input type="button" value=" = " onClick="calc()">
</tr>
</table>
</form>
</body>
----------------------------------------------------------------------
Laufschriften <head>
<script language="JavaScript">
<!--
timer=null;
text="";
wahl="";
ll=0;
ii=0;
function start(cc) {
wahl=cc;
if(cc == '1') {
start1("Das ist eine Laufschrift + "+
"Erstellt mit JavaScript + "+
"Das koennen Sie auch !");
} else if(cc == '2') {
start2("Das ist ein relativ kurzer Text ");
} else {
document.form1.text1.value="schau mal in die Status-Zeile !"
start3("ich hasse Lauftexte in der Status-Zeile ! ");
}
}
function start1(cc) {
text=cc;
ll=text.length;
ii=0;
lauf1();
}
function lauf1() {
if(wahl != '1')return;
document.form1.text1.value=text.substring(ii,ll)+" "+text.substring(0,ii);
ii++;
if(ii > ll)ii=0;
timer=setTimeout("lauf1()", 100);
}
function start2(cc) {
text=cc;
ll=text.length;
ii=0;
lauf2();
}
function lauf2() {
if(wahl != '2')return;
document.form1.text1.value=text.substring(0,ii);
ii++;
if(ii > ll)ii=0;
timer=setTimeout("lauf2()", 100);
}
function start3(cc) {
text=cc;
ll=text.length;
ii=0;
lauf3();
}
function lauf3() {
if(wahl != '3')return;
window.status=text.substring(0,ii);
ii++;
if(ii > ll)ii=0;
timer=setTimeout("lauf3()", 200);
}
function stop() {
wahl='0';
if(timer != null) {
clearTimeout(timer);
timer=null;
}
}
//-->
</script>
</head>
<body onLoad="start('1')">
<form name="form1">
<input type="text" size=50 name="text1" value=""><br>
<input type="button" value="Start 1" onClick="start('1')"><br>
<input type="button" value="Start 2" onClick="start('2')"><br>
<input type="button" value="Start 3" onClick="start('3')"><br>
<input type="button" value="Stop" onClick="stop()">
</form>
</body>
-----------------------------------------------------------------------
Es wird ein eigenständiges kleines Fenster geöffnet, in dem ein Folge von HTML-Seiten dargestellt wird. Beim ersten und letzten Bild wird der Hintergrund auf- bzw. abgeblendet. <script language="JavaScript">
<!--
function texte() {
this[0]="Auf Los ...<p><font color=#ffffff>...geht's los</font>";
this[1]="Heute";
this[2]="<br>zeigen wir";
this[3]="<br><br>JavaScript";
this[4]="<br><br><br>für Alle!";
this[5]="dia1.htm";
this[6]="dia2.htm";
this[7]="dia3.htm";
this[8]="Game<p><font color=#000000>over</font>";
if(navigator.appName.substring(0,5) == "Micro") {
this.length=8;
} else {
this.length=9;
}
}
text=new texte();
win=null;
tim=null;
WAIT1=200;
WAIT2=1000;
WAIT3=3000;
function init() {
bref=window.location.href.toLowerCase();
bref=bref.substring(0, bref.indexOf("dia"));
win=window.open("", "dia_show", "width=300,height=300");
num=0;
col=15;
stop=false;
show();
}
function show() {
if(stop) {
win.close();
return;
}
if(win.focus != null)win.focus();
if(text[num].indexOf(".htm") > 0) {
win.location.href=bref+text[num];
wait=WAIT3;
} else {
win.document.open("text/html");
win.document.write("<base href=\""+bref+"\">");
if(num == 0) {
win.document.write("<body bgColor=#ffffff text=#000000>");
} else {
win.document.write("<body bgColor=#000000 text=#ffffff>");
}
win.document.write("<img src=\"rc_"+num+".gif\" width=15 height=20 hspace="+15*num+">");
win.document.write("<br><center><h1>");
win.document.write(text[num]);
win.document.write("</center></body>");
win.document.close();
wait=WAIT2;
}
num++;
if(num == 1) {
fade();
} else if(num < text.length) {
tim=setTimeout("show()", wait);
} else {
tim=setTimeout("fade()", WAIT1);
}
}
function fade() {
if(stop) {
win.close();
return;
}
if(num == 1) {
col--;
} else {
col++;
}
hex="0123456789abcdef".charAt(col);
hex=hex+hex+hex+hex+hex+hex;
win.document.bgColor=hex;
if(col > 0 && col < 15) {
tim=setTimeout("fade()", WAIT1);
} else {
if(num == 1) {
tim=setTimeout("show()", WAIT2);
} else {
tim=setTimeout("win.close()", WAIT3);
}
}
}
function exit() {
stop=true;
}
//-->
</script>
--------------------------------------------------------------------
for und zurück <a href="javascript:history.forward()"
onMouseOver="{window.status='Vor'; return true;}"
onMouseOut="{window.status=''; return true;}">
<img src="ns_next.gif" width=30 height=30 border=0></a>
<a href="javascript:history.back()"
onMouseOver="{window.status='Zurück'; return true;}"
onMouseOut="{window.status=''; return true;}">
<center><img src="ns_prev.gif" width=30 height=30 border=0></a>
-------------------------------------------------------------------
Farbmischer <script language="JavaScript">
<!--
function rgb() {
this.r=0;
this.g=0;
this.b=0;
}
col=new rgb();
function change(what, delta) {
col[what]+=delta;
if(col[what] < 0) {
col[what]=0;
} else if(col[what] > 255) {
col[what]=255;
}
document.form1[what].value=hex(col[what]);
if(setBg) {
parent.bot.document.bgColor="#"+hex(col.r)+hex(col.g)+hex(col.b);
} else {
fg="#"+hex(col.r)+hex(col.g)+hex(col.b);
bg=parent.bot.document.bgColor;
parent.bot.document.open("text/html");
parent.bot.document.write("<body bgColor="+bg+" text="+fg+">");
parent.bot.document.write("<center>Mischen Sie Ihre Farbe !</center>");
parent.bot.document.write("</body>");
parent.bot.document.close();
}
}
HEX="0123456789abcdef";
function hex(ii) {
i1=Math.floor(ii/16);
i2=ii-i1*16;
return HEX.charAt(i1)+HEX.charAt(i2);
}
function deco(what, doit) {
i1=dec1(document.form1[what].value.charAt(0));
i2=dec1(document.form1[what].value.charAt(1));
col[what]=i1*16+i2;
if(doit)change(what, 0);
}
function dec1(cc) {
for(ii=0; ii<16; ii++) {
if(cc.toLowerCase() == HEX.charAt(ii))break;
}
if(ii>=16)alert(cc);
return ii;
}
function init(what) {
document.form1.r.value=parent.bot.document[what].substring(1,3);
deco('r',0);
document.form1.g.value=parent.bot.document[what].substring(3,5);
deco('g',0);
document.form1.b.value=parent.bot.document[what].substring(5,7);
deco('b',0);
}
setBg=1;
function bck(ii) {
setBg=ii;
if(ii) {
init("bgColor");
} else {
init("fgColor");
}
}
//-->
</script>
</head>
<body onLoad="init('bgColor');">
<form name="form1">
<table border>
<tr><th>R<th>G<th>B</tr>
<tr><td><center>
<input type="button" onClick="change('r', 8)" value="++"><br>
<input type="button" onClick="change('r', 1)" value=" + "><br>
<input type="text" size=2 maxlen=2 name="r" onChange="deco('r',1)"><br>
<input type="button" onClick="change('r',-1)" value=" - "><br>
<input type="button" onClick="change('r',-8)" value=" -- "></center>
<td><center>
<input type="button" onClick="change('g', 8)" value="++"><br>
<input type="button" onClick="change('g', 1)" value=" + "><br>
<input type="text" size=2 maxlen=2 name="g" onChange="deco('g',1)"><br>
<input type="button" onClick="change('g',-1)" value=" - "><br>
<input type="button" onClick="change('g',-8)" value=" -- "></center>
<td><center>
<input type="button" onClick="change('b', 8)" value="++"><br>
<input type="button" onClick="change('b', 1)" value=" + "><br>
<input type="text" size=2 maxlen=2 name="b" onChange="deco('b',1)"><br>
<input type="button" onClick="change('b',-1)" value=" - "><br>
<input type="button" onClick="change('b',-8)" value=" --"></center>
</tr>
</table>
<table>
<tr><td><input type="radio" name="back" onClick="bck(0)">Vordergrund</tr>
<tr><td><input type="radio" name="back" onClick="bck(1)" checked>Hintergrund</tr>
</table>
</form>
</body>
----------------------------------------------------------------------
Frage nach Namen <head>
<script language="JavaScript">
<!--
LIVEDAYS=90;
function set_cookie(name, value) {
document.cookie=name+"="+escape(value)+"; expires="+cookie_live();
}
function cookie_live() {
var date=new Date();
date.setDate(date.getDate()+LIVEDAYS);
var gmt=date.toGMTString();
var k1=gmt.indexOf(" ");
var k2=gmt.indexOf(" ", k1+1);
var k3=gmt.indexOf(" ", k2+1);
var str=gmt.substring(0,k2)+"-"+gmt.substring(k2+1,k3)+"-"+gmt.substring(k3+3,gmt.length);
return str;
}
function get_cookie(name) {
var value=null;
if(document.cookie != "") {
var kk=document.cookie.indexOf(name+"=");
if(kk >= 0) {
kk=kk+name.length+1;
var ll=document.cookie.indexOf(";", kk);
if(ll < 0)ll=document.cookie.length;
value=document.cookie.substring(kk, ll);
value=unescape(value);
}
}
return value;
}
//-->
</script>
</head>
<body>
anrede=get_cookie("anrede");
if(anrede == null) {
anrede=prompt("Wie soll ich Sie anreden ?");
if(anrede == null || anrede == "") {
anrede="(unbekannter User)";
} else {
set_cookie("anrede", anrede);
}
}
document.write(anrede);
</body>
----------------------------------------------------------------------
so hier das waren ma wieder en par =) wenn ich wieder welche find schreib ichse wieda hier rein