# Probleme mit anzeige



## marconeu (13. Feb 2008)

Hi Leutz,
hab da ein Problem und bin echt am verzweifeln.

Hab auf meiner webseite ein sript reingebastelt * www.clan-for-warrock.de*
Wenn man jetzt über dieses menue fährt klappt eine Tabelle nach unten aus.
dort sind dann einzelne links allerdings kann ich die unteren nicht anklicken vorher verschindet die tabelle
kann sich jemand das problem anschauen und mir weiterhelfen. Wäre wirklich sehr dankbar dafür
 Gruß marconeu
Hier erstmal der Sript code:


```
<html>
<head>
<style>
all.clsMenuItemNS, .clsMenuItemIE{text-decoration: none; font: bold 12px Time New Roman; color: white; cursor: hand; z-index:100}
#MainTable A:hover {color: yellow;}
</style>

<script language="JavaScript">

//Top Nav Bar I v2- By Constantin Kuznetsov Jr. (script@esolutiononline.com) 

var keepstatic=1 //specify whether menu should stay static 0=non static (works only in IE4+)
var menucolor="#333333" //specify menu color
var submenuwidth=150 //specify sub menus' color

</script>

<title>Welcome to Homepage</title>
</head>

<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">

<script language="JavaScript">
if (document.all)    {n=0;ie=1;ns6=0;fShow="visible";fHide="hidden";}
if (document.getElementById&&!document.all)    {n=0;ie=0;ns6=1;fShow="visible";fHide="hidden";}
if (document.layers) {n=1;ie=0;ns6=0;fShow="show";fHide="hide";}

//Top Nav bar script v2- [url]http://www.dynamicdrive.com/dynamicindex1/sm/index.htm[/url]

opr6=ie&&navigator.userAgent.indexOf("Opera")!=-1

//window.onerror=new Function("return true")
////////////////////////////////////////////////////////////////////////////
// Function Menu()                                                        //
////////////////////////////////////////////////////////////////////////////
rightX = 0;
function Menu()
{
	this.bgColor     = menucolor;
	if (ie) this.menuFont = "bold 12px Times New Roman";
	if (n)  this.menuFont = "bold 12px Times New Roman";
	this.fontColor   = "black";

	this.addItem    = addItem;
	this.addSubItem = addSubItem;
	this.showMenu   = showMenu;
	this.mainPaneBorder = 0;
	this.subMenuPaneBorder = 0;

	this.subMenuPaneWidth = submenuwidth;

	lastMenu = null;
	
	rightY = 0;
	leftY = 0;
	leftX = 0;

	HTMLstr = "";
	HTMLstr += "\n";
	HTMLstr += "\n";
	if (ie||ns6) HTMLstr += "<div id='MainTable' style='position:relative;top:0'>\n";
//	if (n)  HTMLstr += "<layer name='MainTable'>\n";
	HTMLstr += "<table width='100%' bgcolor='"+this.bgColor+"' border='"+this.mainPaneBorder+"'>\n";
	HTMLstr += "<tr>";
	if (n) HTMLstr += "<td> ";
	HTMLstr += "\n";
	HTMLstr += "\n";
	HTMLstr += "\n";
	if (n) HTMLstr += "</td>";
	HTMLstr += "</tr>\n";
	HTMLstr += "</table>\n";
	HTMLstr += "\n";
	HTMLstr += "\n";
	HTMLstr += "\n";
	HTMLstr += "\n";
	HTMLstr += "\n";
	if (ie||ns6) HTMLstr+= "</div>\n";
//	if (n)  HTMLstr+= "</layer>\n";
	HTMLstr += "\n";
}

function addItem(idItem, text, hint, location, altLocation)
{
	var Lookup = "";
	if (HTMLstr.indexOf(Lookup) != -1)
	{
		alert(idParent + " already exist");
		return;
	}
	var MENUitem = "";
	MENUitem += "\n\n";
	if (n)
	{
		MENUitem += "<ilayer name="+idItem+">";
		MENUitem += "<a href='.' class=clsMenuItemNS onmouseover=\"displaySubMenu('"+idItem+"')\" onclick=\"return false;\">";
		MENUitem += "| ";
		MENUitem += text;
		MENUitem += "</a>";
		MENUitem += "</ilayer>";
	}
	if (ie||ns6)
	{
		MENUitem += "<td>\n";
		MENUitem += "<div id='"+idItem+"' style='position:relative; font: "+this.menuFont+";'>\n";
		MENUitem += "<a ";
		MENUitem += "class=clsMenuItemIE ";
//		MENUitem += "style='text-decoration: none; font: "+this.menuFont+"; color: "+this.fontColor+"; cursor: hand;' ";
		if (hint != null)
			MENUitem += "title='"+hint+"' ";
		if (location != null)
		{
			MENUitem += "href='"+location+"' ";
			MENUitem += "onmouseover=\"hideAll()\" ";
		}
		else
		{
			if (altLocation != null)
				MENUitem += "href='"+altLocation+"' ";
			else
				MENUitem += "href='.' ";
			MENUitem += "onmouseover=\"displaySubMenu('"+idItem+"')\" ";
			MENUitem += "onclick=\"return false;\" "
		}
		MENUitem += ">";
		MENUitem += "| \n";
		MENUitem += text;
		MENUitem += "</a>\n";
		MENUitem += "</div>\n";
		MENUitem += "</td>\n";
	}
	MENUitem += "\n\n";
	MENUitem += "\n";

	HTMLstr = HTMLstr.replace("\n", MENUitem);
}

function addSubItem(idParent, text, hint, location)
{
	var MENUitem = "";
	Lookup = "";
	if (HTMLstr.indexOf(Lookup) == -1)
	{
		alert(idParent + " not found");
		return;
	}
	Lookup = "";
	if (HTMLstr.indexOf(Lookup) == -1)
	{
		if (n)
		{
			MENUitem += "\n";
			MENUitem += "<layer id='"+idParent+"submenu' visibility=hide bgcolor='"+this.bgColor+"'>\n";
			MENUitem += "<table border='"+this.subMenuPaneBorder+"' bgcolor='"+this.bgColor+"' width="+this.subMenuPaneWidth+">\n";
			MENUitem += "\n";
			MENUitem += "</table>\n";
			MENUitem += "</layer>\n";
			MENUitem += "\n";
		}
		if (ie||ns6)
		{
			MENUitem += "\n";
			MENUitem += "<div id='"+idParent+"submenu' onmouseout=operahide() style='position:absolute; visibility: hidden; z-index:100; width: "+this.subMenuPaneWidth+"; font: "+this.menuFont+"; top: -300;'>\n";
			MENUitem += "<table border='"+this.subMenuPaneBorder+"' bgcolor='"+this.bgColor+"' width="+this.subMenuPaneWidth+">\n";
			MENUitem += "\n";
			MENUitem += "</table>\n";
			MENUitem += "</div>\n";
			MENUitem += "\n";
		}
		MENUitem += "\n";
		HTMLstr = HTMLstr.replace("\n", MENUitem);
	}

	Lookup = "\n";
	if (n)  MENUitem = "<tr><td>[url='"+location+"']"+text+"[/url]
</td></tr>\n";
	if (ie||ns6) MENUitem = "<tr><td>[url='"+location+"']"+text+"[/url]
</td></tr>\n";
	MENUitem += Lookup;
	HTMLstr = HTMLstr.replace(Lookup, MENUitem);

}

function showMenu()
{
	document.writeln(HTMLstr);
}

////////////////////////////////////////////////////////////////////////////
// Private declaration
function displaySubMenu(idMainMenu)
{
	var menu;
	var submenu;
	if (n)
	{
		submenu = document.layers[idMainMenu+"submenu"];
		if (lastMenu != null && lastMenu != submenu) hideAll();
		submenu.left = document.layers[idMainMenu].pageX;
		submenu.top  = document.layers[idMainMenu].pageY + 25;
		submenu.visibility = fShow;

		leftX  = document.layers[idMainMenu+"submenu"].left;
		rightX = leftX + document.layers[idMainMenu+"submenu"].clip.width;
		leftY  = document.layers[idMainMenu+"submenu"].top+
			document.layers[idMainMenu+"submenu"].clip.height;
		rightY = leftY;
	} else if (ie||ns6) {
//alert(document.getElementById(idMainMenu+"submenu").id)
		menu = ie? eval(idMainMenu) : document.getElementById(idMainMenu);
		submenu = ie? eval(idMainMenu+"submenu.style") : document.getElementById(idMainMenu+"submenu").style;
		submenu.left = calculateSumOffset(menu, 'offsetLeft');
//		submenu.top  = calculateSumOffset(menu, 'offsetTop') + 30;
		submenu.top  = menu.style.top+23;
		submenu.visibility = fShow;
		if (lastMenu != null && lastMenu != submenu) hideAll();

		leftX  = ie? document.all[idMainMenu+"submenu"].style.posLeft : parseInt(document.getElementById(idMainMenu+"submenu").style.left);
		rightX = ie? leftX + document.all[idMainMenu+"submenu"].offsetWidth : leftX+parseInt(document.getElementById(idMainMenu+"submenu").offsetWidth);

		leftY  = ie? document.all[idMainMenu+"submenu"].style.posTop+
			document.all[idMainMenu+"submenu"].offsetHeight : parseInt(document.getElementById(idMainMenu+"submenu").style.top)+parseInt(document.getElementById(idMainMenu+"submenu").offsetHeight);
		rightY = leftY;
	}
	lastMenu = submenu;
}

function hideAll()
{
	if (lastMenu != null) {lastMenu.visibility = fHide;lastMenu.left = 0;}
}

function calculateSumOffset(idItem, offsetName)
{
	var totalOffset = 0;
	var item = eval('idItem');
	do
	{
		totalOffset += eval('item.'+offsetName);
		item = eval('item.offsetParent');
	} while (item != null);
	return totalOffset;
}

function updateIt(e)
{
	if (ie&&!opr6)
	{
		var x = window.event.clientX;
		var y = window.event.clientY;

		if (x > rightX || x <leftX) hideAll();
		else if (y > rightY) hideAll();
	}
	if (n||ns6)
	{
		var x = e.pageX;
		var y = e.pageY;

		if (x > rightX || x <leftX) hideAll();
		else if (y > rightY) hideAll();
	}
}

function operahide(){
        if (opr6){
        if (!MainTable.contains(event.toElement))
        hideAll()
}
}

if (ie||ns6)
{
	document.body.onclick=hideAll;
	document.body.onscroll=hideAll;
	document.body.onmousemove=updateIt;
}
if (document.layers)
{
	window.captureEvents(Event.MOUSEMOVE);
	window.captureEvents(Event.CLICK);
	window.onmousemove=updateIt;
	window.onclick=hideAll;
}

</script>
<script language="JavaScript">

function showToolbar()
{
// AddItem(id, text, hint, location, alternativeLocation);
// AddSubItem(idParent, text, hint, location);

	menu = new Menu();
	menu.addItem("webmasterid", "Warrock", "Warrock",  null, null);
	menu.addItem("newsid", "Links", "Links",  null, null);
	menu.addItem("freedownloadid", "E-Mail Konten", "E-Mail Konten",  null, null);
	menu.addItem("searchengineid", "Andere Games", "Andere Games",  null, null);
	menu.addItem("miscid", "Partner", "Partner",  null, null);

	menu.addSubItem("webmasterid", "Warrock", "Warrco",  "http://www.warrock.net/");
	menu.addSubItem("webmasterid", "Warrock-hq", "Warrock-hq",  "http://78.46.43.227/v4/news.php");
	menu.addSubItem("webmasterid", "Warrock Clan Systems", "Warrock Clan Systems",  "http://ops.warrock.net/");
	menu.addSubItem("webmasterid", "Warrock Forum", "Warrock Forum",  "http://forum.warrock.net/");
	menu.addSubItem("webmasterid", "Warrock Download", "Warrock Download",  "http://www.warrock.net/download.php");
	menu.addSubItem("webmasterid", "TSViewer", "TSViewer",  "http://www.tsviewer.com/");

	menu.addSubItem("newsid", "GIGA TV", "GIGA TV",  "http://www.giga.de/");
	menu.addSubItem("newsid", "GOOGLE", "GOOGLE",  "http://www.google.de/webhp?hl=de");
	menu.addSubItem("newsid", "Wikipedia", "Wikipedia",  "http://de.wikipedia.org/wiki/Hauptseite");
	menu.addSubItem("newsid", "Ebay", "Ebay",  "http://www.ebay.de/");
	menu.addSubItem("newsid", "Amazon", "Amazon",  "http://www.amazon.de/");
	menu.addSubItem("newsid", "Click and Buy", "Click and Buy",  "http://www.clickandbuy.com/DE/de/");
	menu.addSubItem("newsid", "MyVideo", "MyVideo",  "http://www.myvideo.de/");

	menu.addSubItem("freedownloadid", "WEB.de", "WEB:DE",  "http://www.web.de/");
	menu.addSubItem("freedownloadid", "Yahoo", "Yahoo",  "http://de.yahoo.com/");
	menu.addSubItem("freedownloadid", "AOL", "AOL",  "http://www.aol.de/");
   menu.addSubItem("freedownloadid", "GMX", "GMX",  "http://www.gmx.net/");

	menu.addSubItem("searchengineid", "Medal of Honor", "Medal of Honor",  "http://www.moh-news.de/");
	menu.addSubItem("searchengineid", "Battlefield", "Battlefield",  "http://www.battlefield-1942.net/");
	menu.addSubItem("searchengineid", "Call of Duty", "Call of Duty", "http://www.callofduty.com/");
	menu.addSubItem("searchengineid", "Counterstrike", "Counterstrike",  "http://www.4players.de/cs.php/index/-/index.html");
   menu.addSubItem("searchengineid", "Anno 1701", "Anno 1701",   "http://www.anno1701.de/teaser/");

	menu.addSubItem("miscid", "manuelneu.mine.nu", "manuelneu.mine.nu",  "http://www.dj-manu.de/10.html");
	menu.addSubItem("miscid", "Jens Neu`s Leinwand", "Jens Neu`s Leinwand",  "http://www.jens-neu.de/");
	menu.addSubItem("miscid", "Auto5000Liga", "Auto5000Liga",  "http://www.auto5000liga.de");
   menu.addSubItem("miscid", "DNS", "DNS",   "http://www.doreen-neu-services.de/index.html");

	menu.showMenu();
}
</script>
<script language="JavaScript">
showToolbar();
</script>
<script language="JavaScript">
function UpdateIt(){
if (ie&&keepstatic&&!opr6)
document.all["MainTable"].style.top = document.body.scrollTop;
setTimeout("UpdateIt()", 200);
}
UpdateIt();
</script>
```


----------



## DocRandom (13. Feb 2008)

..tjo, schönes Script, nur falsches Forum!
Javascript != JAVA

lg
DocRandom


----------



## marconeu (13. Feb 2008)

hi DocRandom,

 wieso ist das das falsche forum Java javascript ist doch das gleiche oder??
 Bin Newbee in diesen sachen deshalb thread auch im anfängerbereich


----------



## marconeu (13. Feb 2008)

sorry wirklich falsches forum,
hatte regeln nicht gelesen !!
 :bahnhof: 
ja wer lesen kann ist klar im vorteil?? :bloed:


----------



## L-ectron-X (13. Feb 2008)

http://www.java-forum.org/de/topic17227_ihr-seid-falschen-forum.html
Was aber nicht heißt, dass es hier niemanden gibt, der sich mit JavScript auskennt.


----------



## number8 (14. Feb 2008)

Ich muss mal sagen, daß das Lesen des Quellcodes keine Freude bereitet. So gut wie nix ist kommentiert. Gut, vieles erklärt sich selbst, aber es gibt auch sehr lange Konstrukte da drin, und die will ich nicht erst auseinanderpflücken. Ah ja, warum werden die Style-Attribute einzeln gesetzt und nicht per className geholt? Und wäre es nicht einfacher gewesen, die SubMenus als Divs in HTML zu schreiben?


----------

