PeterK: Site testen -- nächster anlauf

Beitrag lesen

Ich denk ma, das liegt an den Scripts. Denn die Schreiben den Inhalt. Was stimmt denn hieran nicht:

Datei MapList.js (hier trag ich alle neuen Seiten ein)

var MapPath = "../../data/maps/";
var ScrPath = "../../data/screenshots/";
var maps = new Array;

// maps[n] = new Array("name","type","description",size (KB),"author");
maps[0] = new Array("DM-Underground","DM","Diese Map spielt in der Kanalisation. Es gibt eine Arena (siehe Screenshot), in der der meiste Kampf stadtfindet, aber man kann genausogut ein Duell in engen Röhren -- ohne Fluchtmöglichkeit -- austragen. Sie ist meine erste Map und ich hoffe, dass sie ganz gut ist.",355,"Peter Körner");

Nun die MapScript.js (der Rest)

var DATA_NAME = 0;
var DATA_TYPE = 1;
var DATA_DESC = 2;
var DATA_SIZE = 3;
var DATA_AUTHOR = 4;

function ListMaps(type)
{
  document.write('<h3>Liste der Maps vom typ ' + type + '</h3>');
  document.write('<table border="3" cellspacing="0" cellpadding="5" frame="void"><tr>');
  document.write('<td width="256"><b>Name</b></td>');
  document.write('<td width="128"><b>Größe</b></td>');
  document.write('<td width="128"><b>Author</b></td></tr>');
  for(var i = 0; i < maps.length; i++)
  {
    if(maps[i][DATA_TYPE] == type)
    {
      document.write('<tr><td><a href="deteil.html?mapid=' + i + '">' + maps[i][DATA_NAME] + '</a></td><td>' + maps[i][DATA_SIZE] + ' KB</td><td>' + HTMLEncode(maps[i][DATA_AUTHOR]) + '</tr>');
    }
  }
  document.write('</table>');
}

function ShowDeteils()
{
  var data = new Array();
  data = SplitEnviron();
  var mapid = data['mapid'];
  document.write('<table border="0" cellspacing="0" cellpadding="5">');
  document.write('<tr><td colspan="3"><h1>' + maps[mapid][DATA_NAME] + '</h1></td></tr>');
  document.write('<tr height="256"><td>&nbsp</td>');
  document.write('<td width="256"><img src="' + ScrPath + maps[mapid][DATA_NAME] + '.jpg" alt="Screenshot"></td>');
  document.write('<td valign="top"><p><b>Author:</b><br>' + HTMLEncode(maps[mapid][DATA_AUTHOR]) + '<br><br><b>Größe</b><br>' + maps[mapid][DATA_SIZE] + ' KB</b></p></td></tr>');
  document.write('<tr><td colspan="3"><p>' + HTMLEncode(maps[mapid][DATA_DESC]) + '</p></td></tr>');
  document.write('<tr><td> </td><td> </td><td><a href="' + MapPath + maps[mapid][DATA_NAME] + '.zip"><img border="0" src="../pics/download.gif" alt="Download"></a></td></tr>');
  document.write('</table>');
}

function SplitEnviron()
{
  var name = "", wert = "", i = 0, Environ = "";
  var Pairs = new Array;
  var Erg = new Array;
  if(window.location.search == "") { return ""; }
  Environ = window.location.search.substring(1, window.location.search.length);
  Pairs = Environ.split("&")
  for(i; i < Pairs.length; i++)
  {
    name = Pairs[i].substring(0, Pairs[i].indexOf("="));
    wert = Pairs[i].substring(Pairs[i].indexOf("=") + 1, Pairs[i].length);
    Erg[name] = wert;
  }
  return Erg;
}

function HTMLEncode(srcStr)
{
  var dstStr = "";

dstStr = srcStr;
  dstStr = dstStr.replace(/&/,"&");
  dstStr = dstStr.replace(/ä/,"ä");
  dstStr = dstStr.replace(/ö/,"ö");
  dstStr = dstStr.replace(/ü/,"ü");
  dstStr = dstStr.replace(/Ä/,"&Auml;");
  dstStr = dstStr.replace(/Ö/,"&Ouml;");
  dstStr = dstStr.replace(/Ü/,"&Uuml;");
  dstStr = dstStr.replace(/</,"<");
  dstStr = dstStr.replace(/>/,">");
  dstStr = dstStr.replace(/ß/,"ß");
  dstStr = dstStr.replace(/"/,""");

//  alert(srcStr + "   =>   " + dstStr);
  return dstStr;
}

Thx. PeterK