| Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
| Autor |
Nachricht |
Werner Homepage-Total.de Moderator

|
 |
|
|
Ich habe mir erlaubt deinen Code der "heutigen Zeit" anzupassen
(also ohne FONT und ALIGN, etc.)
| PHP-Code: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
| <!DOCTYPE html>
<title>Namen Generator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body, table {
font-family: "Comic Sans MS", Verdana;
}
</style>
<script type="text/javascript">
fullName = new String;
var x = 0;
var currentNum = 0;
var currentChar;
var y = 0;
var smurfNames = new Array(
"Halunki",
"Seppl",
"Halodri",
"Chesty",
"Bambi",
"Insatiable",
"Quantum",
"Lydia" // Hinter dem letzten Wert, kein Komma hinzufügen!
);
function matchLtr() {
if (currentChar == "a" || currentChar == "A") {
currentNum = 1;
}
if (currentChar == "b" || currentChar == "B") {
currentNum = 2;
}
if (currentChar == "c" || currentChar == "C") {
currentNum = 3;
}
if (currentChar == "d" || currentChar == "D") {
currentNum = 4;
}
if (currentChar == "e" || currentChar == "E") {
currentNum = 5;
}
if (currentChar == "f" || currentChar == "F") {
currentNum = 6;
}
if (currentChar == "g" || currentChar == "G") {
currentNum = 7;
}
if (currentChar == "h" || currentChar == "H") {
currentNum = 8;
}
if (currentChar == "i" || currentChar == "I") {
currentNum = 9;
}
if (currentChar == "j" || currentChar == "J") {
currentNum = 10;
}
if (currentChar == "k" || currentChar == "K") {
currentNum = 11;
}
if (currentChar == "l" || currentChar == "L") {
currentNum = 12;
}
if (currentChar == "m" || currentChar == "M") {
currentNum = 13;
}
if (currentChar == "n" || currentChar == "N") {
currentNum = 14;
}
if (currentChar == "o" || currentChar == "O") {
currentNum = 15;
}
if (currentChar == "p" || currentChar == "P") {
currentNum = 16;
}
if (currentChar == "q" || currentChar == "Q") {
currentNum = 17;
}
if (currentChar == "r" || currentChar == "R") {
currentNum = 18;
}
if (currentChar == "s" || currentChar == "S") {
currentNum = 19;
}
if (currentChar == "t" || currentChar == "T") {
currentNum = 20;
}
if (currentChar == "u" || currentChar == "U") {
currentNum = 21;
}
if (currentChar == "v" || currentChar == "V") {
currentNum = 22;
}
if (currentChar == "w" || currentChar == "W") {
currentNum = 23;
}
if (currentChar == "x" || currentChar == "X") {
currentNum = 24;
}
if (currentChar == "y" || currentChar == "Y") {
currentNum = 25;
}
if (currentChar == "z" || currentChar == "Z") {
currentNum = 26;
}
x += currentNum;
}
function selName() {
x = 0;
fullName = document.names.firstName.value + document.names.lastName.value;
for (var i = 0; i < fullName.length; i++) {
currentChar = fullName.charAt(i);
matchLtr();
}
popName();
}
function popName() {
y = x % 90;
document.names.smurfName.value = smurfNames[y] + ((y == 78) ? ' Smurfy' : ' Schlumpf');
}
</script>
</head>
<body>
<form name="names">
<table border="0" cellpadding="10" cellspacing="3" style="width: 85%; margin: auto;">
<caption><h1>Namen Generator</h1></caption>
<tr>
<td style="text-align: center;">Bitte trage deinen Namen ein</td>
<td rowspan="4" style="width: 35%;"> <img src="" width="153" height="251"> </td>
</tr>
<tr>
<td>
<table style="width: 35%; margin: auto;">
<tr>
<td>Vorname:</td>
<td> <input type="text" name="firstName" autofocus="autofocus"> </td>
</tr>
<tr>
<td>Nachname:</td>
<td> <input type="text" name="lastName"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<th> <input type="button" onClick="selName()" value=" DRÜCK MICH "> </th>
</tr>
<tr>
<td style="text-align: center;">Dein Name ist:</td>
</tr>
<tr>
<th><input type="text" name="smurfName" size="28" readonly="readonly"></th>
</tr>
</table>
</form>
</body>
</html> |
Im nachfolgenden Script (eine Diashow) siehst du wie Bilder (Adressen)
und Text in Arrays gespeichert werden und wie diese ausgegeben
werden können.
| PHP-Code: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| <!DOCTYPE HTML>
<html>
<head>
<title>Diashow</title>
<script type="text/javascript">
// Diashow
var Bild = new Array();
var Beschreibung = new Array();
Bild[0] = new Image(190, 190); Bild[0].src="bilder_txt/001.jpg";
Beschreibung[0]="<b>1/7<\/b> - China um 1620";
Bild[1] = new Image(190, 190); Bild[1].src="bilder_txt/002.jpg";
Beschreibung[1]="<b>2/7<\/b> - China um 1765";
Bild[2] = new Image(190, 190); Bild[2].src="bilder_txt/003.jpg";
Beschreibung[2]="<b>3/7<\/b> - China um 1880";
Bild[3] = new Image(190, 190); Bild[3].src="bilder_txt/004.jpg";
Beschreibung[3]="<b>4/7<\/b> - Alpen um 1745";
Bild[4] = new Image(190, 190); Bild[4].src="bilder_txt/005.jpg";
Beschreibung[4]="<b>5/7<\/b> - Athen um 1429";
Bild[5] = new Image(190, 190); Bild[5].src="bilder_txt/006.jpg";
Beschreibung[5]="<b>6/7<\/b> - Venedig um 1873";
var aktuell = 0, ende = 7;
function blaettern(richtung) {
if (aktuell+richtung >= 0 && aktuell+richtung < ende) {
aktuell += richtung;
document.getElementById("dummy").src=Bild[aktuell].src;
document.getElementById("dummy").width=Bild[aktuell].width;
document.getElementById("dummy").height=Bild[aktuell].height;
document.getElementById("beschreibung").innerHTML = Beschreibung[aktuell];
}
else if (aktuell+richtung >= ende) {
aktuell = 0;
document.getElementById("dummy").src=Bild[aktuell].src;
document.getElementById("beschreibung").innerHTML = Beschreibung[aktuell];
}
}
</script>
</head>
<body onLoad="blaettern(0);">
<a href="javascript:blaettern(-1);">Zurück</a> —
<a href="javascript:blaettern(1);">Vorwärts</a><br><br>
<!-- Erstes Bild hier eintragen -->
<img src="bilder/001.jpg" id="dummy" border="1" />
<div id="beschreibung"></div>
</body>
</html> |
|
_________________ Bei Fragen oder Fehlermeldungen - Bitte ausführlichen Code posten!
Wie man Fragen richtig stellt |
|
|
| 29 Dez 2011 20:53 |
|
  |
|