Javascriptmenü - window.open
Kurt
- javascript
Hallo,
bin seit einiger Zeit bei dem Versuch das Menü so umzuschreiben das der Menüeintrag über den Befehl window.open ein definiertes Fenster öffnet. Da ich es einfach nicht auf die Reihe bekomme stellt sich f. mich die Frage ob Ihr einen Tip habt
Kurt
<!--
var ImageFolder = ""
var m1_img_up = new Image();
m1_img_up.src = ImageFolder + "../images/navi_dot1_p.gif";
var m1_img_over = new Image();
m1_img_over.src = ImageFolder + "../images/navi_dot1_a.gif";
for (n=2; n<8; n++)
{
eval('var m'+n+'_img_up = new Image()');
eval('m'+n+'_img_up.src = ImageFolder + "../images/navi_dot_p.gif"');
eval('var m'+n+'_img_over = new Image()');
eval('m'+n+'_img_over.src = ImageFolder + "../images/navi_dot_a.gif"');
}
function main()
{
var m;
// menu nr. 1
m = menue("m1", 190, 178);
m.addLink("Eintrag11", "../u1.html");
m.addLink("Eintrag12","../u2.html");
m.write();
// menu nr. 2
m = menue("m2", 150, 265);
m.addLink("Eintrag21", "u3.html");
m.addLink("Eintrag22", "u4.html");
// menu nr.3-7 .....
OK = true;
}
var OK = false;
function overImage(img){
if (document.images){
document.images[img].src=eval(img + "_over.src");
}
}
function upImage(img){
if (document.images){
document.images[img].src=eval(img + "_up.src");
}
}
if(document.layers)
{
window.captureEvents(Event.MOUSEUP);
window.onmouseup=hide_all;
}
else
{
document.onmouseup=hide_all;
}
function show_layer(x)
{
// if (OK)
{
if(document.layers) document.layers[x].visibility="show";
if (document.all) document.all[x].style.visibility="visible";
if ((document.getElementById)&& (!document.all)) document.getElementById(x).style.visibility="visible";
}
}
function hide_layer(x)
{
// if (OK)
{
if(document.layers)
document.layers[x].visibility="hide";
if (document.all) document.all[x].style.visibility="hidden";
if ((document.getElementById)&& (!document.all)) document.getElementById(x).style.visibility="hidden";
}
}
function do_menu(x)
{
hide_all();
show_layer(x);
overImage(x+"_img");
}
function hide_all()
{
for (n=1; n<8; n++)
{
eval("hide_layer('m"+n+"')");
eval("upImage('m"+n+"_img')");
}
}
function addLink(name, url)
{
url = ""+url;
this.linkarray = this.linkarray.concat(new Array(new Array(name, url)));
}
function addLinkwithtarget(name, url)
{
url = ""+url;
this.linkarray = this.linkarray.concat(new Array(new Array(name,url)));
}
function addSeparator()
{
this.linkarray = this.linkarray.concat(new Array("SEPARATOR"));
}
function writeMenue()
{
var str = "";
str += '\n<div id="'+this.name+'" style="position: absolute; z-index: 0; top: 51px; left: '+this.leftPosition+'px; visibility: hide; visibility: hidden"> \n';
str += '<table bgcolor="'+this.border+'" cellspacing="0" cellpadding="0" border="0">\n';
str += '<tr><td>\n';
str += '<table background="" cellspacing="1" cellpadding="0" border="0" width="'+this.width+'">\n';
// links schreiben
for (i=0; i<this.linkarray.length; i++)
{
str += ' <tr>\n';
if (this.linkarray[i]=="SEPARATOR")
{
str += '<td bgcolor="'+this.border+'"><img src="images/1px.gif" height="1" width="1"></td>\n';
}
else
{
str += ' <td onmouseover="this.style.backgroundColor=''+this.overcolor+''"\n';
str += ' onclick="location.href=''+this.linkarray[i][1]+''"\n';
str += ' onmouseout="this.style.backgroundColor=''+this.bgcolor+''" bgcolor="'+this.bgcolor+'"><ilayer><layer\n';
str += ' width="'+this.width+'" onMouseover="this.bgColor=''+this.overcolor+'';" \n';
str += ' onMouseout="this.bgColor=''+this.bgcolor+'';"> <a href="'+this.linkarray[i][1]+'" \n';
str += ' class="subnavigation">'+this.linkarray[i][0]+'</a> </layer></ilayer></td> \n';
}
str += ' </tr>\n';
}
str += '</table>\n';
str += '</td></tr>\n';
str += '</table>\n';
str +='</div>\n\n';
document.write(str);
}
function menue(name, width, leftPosition)
{
this.border = "#b9b8c0";
this.bgcolor = "#edf0f5";
this.overcolor = "#b9b8c0";
this.name = name;
this.width = width;
this.leftPosition = leftPosition;
this.linkarray = new Array();
this.write = writeMenue;
this.addLink = addLink;
this.addSeparator = addSeparator;
return this
}
function bka_writestyle(code, menu_code) {
if (menu_code == code) {
document.write ('<span style="color : #ff0000;">');
} else {
document.write ('<span>');
}
}
// -->