Hi :)
Ich hab mir hier ein Script zusammen gebaut:
<style> td.c1 { border-bottom: 1px dotted #000000; }</style>
<body onload="ressource('Ziegelsteine', '1'); ressource('Kohle', '2'); ressource('Bretter', '3'); ressource('Eisen', '4'); ressource('Leder', '5'); ressource('Masten', '6'); ressource('Tuch', '7'); ressource('Schiff', '8'); " bgcolor="#EEEEEE" style="font-face: Verdana;">
[code lang=javascript]<script type="text/javascript">
function ressource(ressource, key)
{
var input = document.getElementById('input_' + key).value;
if(ressource = "Ziegelsteine")
{ html = "<font size='1'><b>Energie:</b> " + (5*input) + "<br><b>Lehm:</b> " + (2*input) + "<br><b>Wasser:</b> " + (2*input) + "<br></font>"; }
else if(ressource = "Kohle")
{ html = "<font size='1'><b>Energie:</b> " + (2*input) + "<br><b>Holz:</b> " + (2*input) + "<br><b>Wasser:</b> " + (1*input) + "<br></font>"; }
else if(ressource = "Bretter")
{ html = "<font size='1'><b>Energie:</b> " + (5*input) + "<br><b>Holz:</b> " + (3*input) + "<br></font>"; }
else if(ressource = "Eisen")
{ html = "<font size='1'><b>Energie:</b> " + (4*input) + "<br><b>Eisenerz:</b> " + (5*input) + "<br><b>Kohle:</b> " + (2*input) + "<br></font>"; }
else if(ressource = "Leder")
{ html = "<font size='1'><b>Energie:</b> " + (20*input) + "<br><b>Fell:</b> " + (1*input) + "<br></font>"; }
else if(ressource = "Masten")
{ html = "<font size='1'><b>Energie:</b> " + (50*input) + "<br><b>Bretter:</b> " + (20*input) + "<br><b>Gold:</b> " + (300*input) + "<br></font>"; }
else if(ressource = "Tuch")
{ html = "<font size='1'><b>Energie:</b> " + (4*input) + "<br><b>Wolle:</b> " + (2*input) + "<br><b>Wasser:</b> " + (1*input) + "<br></font>"; }
else if(ressource = "Schiff")
{ html = "<font size='1'><b>Bretter:</b> " + (300*input) + "<br><b>Masten:</b> " + (4*input) + "<br><b>Tuch:</b> " + (20*input) + "<br><b>Gold:</b> " + (400*input) + "<br></font>"; }
else { html = "<font size='1'>loading failed...</font>"; }
document.getElementById("span" + key).innerHTML = html;
}
</script>
<table border="0" width="500">
<tr><td colspan="3"><font size="2"><b><u>"Ressourcen Verarbeitungs" - Tool<br><br></b></u></font></td></tr>
<tr>
<td class="c1" width="15"><font size="1"><b><u>Anzahl:</b></u></font></td>
<td class="c1" width="150"><font size="1"><b><u>Ressource:</u></b></font></td>
<td class="c1"><font size="1"><b><u>Info:</u></b></font></td>
</tr><tr>
<td class="c1" width="15"><input id="input_1" onkeydown='ressource("Ziegelsteine", "1");' onkeyup='ressource("Ziegelsteine", "1");' onchange='ressource("Ziegelsteine", "1");' onfocus='ressource("Ziegelsteine", "1");' type="text" size="5" value="1" title="Anzahl"></td>
<td class="c1" width="150"><font size="2">Ziegelsteine</font></td>
<td class="c1"><font size="2"><span id="span1"><font size="1">loading ...</font></span></font></td>
</tr><tr>
<td class="c1" width="15"><input id="input_2" onkeydown='ressource("Kohle", "2");' onkeyup='ressource("Kohle", "2");' onchange='ressource("Kohle", "2");' onfocus='ressource("Kohle", "2");' type="text" size="5" value="1" title="Anzahl"></td>
<td class="c1" width="150"><font size="2">Kohle</font></td>
<td class="c1"><font size="2"><span id="span2"><font size="1">loading ...</font></span></font></td>
</tr><tr>
<td class="c1" width="15"><input id="input_3" onkeydown='ressource("Bretter", "3");' onkeyup='ressource("Bretter", "3");' onchange='ressource("Bretter", "3");' onfocus='ressource("Bretter", "3");' type="text" size="5" value="1" title="Anzahl"></td>
<td class="c1" width="150"><font size="2">Bretter</font></td>
<td class="c1"><font size="2"><span id="span3"><font size="1">loading ...</font></span></font></td>
</tr><tr>
<td class="c1" width="15"><input id="input_4" onkeydown='ressource("Eisen", "4");' onkeyup='ressource("Eisen", "4");' onchange='ressource("Eisen", "4");' onfocus='ressource("Eisen", "4");' type="text" size="5" value="1" title="Anzahl"></td>
<td class="c1" width="150"><font size="2">Eisen</font></td>
<td class="c1"><font size="2"><span id="span4"><font size="1">loading ...</font></span></font></td>
</tr><tr>
<td class="c1" width="15"><input id="input_5" onkeydown='ressource("Leder", "5");' onkeyup='ressource("Leder", "5");' onchange='ressource("Leder", "5");' onfocus='ressource("Leder", "5");' type="text" size="5" value="1" title="Anzahl"></td>
<td class="c1" width="150"><font size="2">Leder</font></td>
<td class="c1"><font size="2"><span id="span5"><font size="1">loading ...</font></span></font></td>
</tr><tr>
<td class="c1" width="15"><input id="input_6" onkeydown='ressource("Masten", "6");' onkeyup='ressource("Masten", "6");' onchange='ressource("Masten", "6");' onfocus='ressource("Masten", "6");' type="text" size="5" value="1" title="Anzahl"></td>
<td class="c1" width="150"><font size="2">Masten</font></td>
<td class="c1"><font size="2"><span id="span6"><font size="1">loading ...</font></span></font></td>
</tr><tr>
<td class="c1" width="15"><input id="input_7" onkeydown='ressource("Tuch", "7");' onkeyup='ressource("Tuch", "7");' onchange='ressource("Tuch", "7");' onfocus='ressource("Tuch", "7");' type="text" size="5" value="1" title="Anzahl"></td>
<td class="c1" width="150"><font size="2">Tuch</font></td>
<td class="c1"><font size="2"><span id="span7"><font size="1">loading ...</font></span></font></td>
</tr><tr>
<td class="c1" width="15"><input id="input_8" onkeydown='ressource("Schiff", "8");' onkeyup='ressource("Schiff", "8");' onchange='ressource("Schiff", "8");' onfocus='ressource("Schiff", "8");' type="text" size="5" value="1" title="Anzahl"></td>
<td class="c1" width="150"><font size="2">Schiff</font></td>
<td class="c1"><font size="2"><span id="span8"><font size="1">loading ...</font></span></font></td>
</tr></table></body>[/code]
Nur Leider funktioniert das Ganze nicht.
Beim body onload lädt das Script immer nur die Daten für die Ziegelsteine, also den 1.Eintrag. Und das in jeder Box!
Wer kann mir helfen?