WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 Bug in DHTML menu, Ali Akbar, July 17, 2004
     Re:Bug in DHTML menu, Erik Arvidsson, July 19, 2004

Subject: Bug in DHTML menu From: Ali Akbar Date: July 17, 2004

I want to point out a bug in DHTML menu which shows wrong menu items in menu. here is the source code:

 var menuBar = new MenuBar();
 var testMenu = new Menu();

 var tmp = new MenuItem("New Window", document.location.href);
 testMenu.add(tmp);
 tmp.target = "_blank";
 tmp.mnemonic = 'n';
 tmp.shortcut = "Ctrl+N";

 var tmp1 = new MenuItem("WebFX Home", function () { alert("Clicked " + this.text);}, "http://webfx.eae.net/images/favicon.gif");
 testMenu.add(tmp1);
 tmp1.mnemonic = 'w';
 
 var tmp2 = new MenuItem("Alert", function () { alert("Clicked " + this.text); });
 testMenu.add(tmp2);
 tmp1.mnemonic = 'a';
 
 testMenu.add(new MenuSeparator);
 
 var tmp3 = new MenuItem("Close", function () { window.close(); });
 testMenu.add(tmp3);
 tmp3.mnemonic = 'c';

 var testButton = new MenuButton("Test", testMenu);
 testButton.mnemonic = "t";
 menuBar.add(testButton);
 menuBar.write();

The above generate a menu whose first two items has the same name i.e "New Window"

and this is exactly in the same patren as defined in demo except the change that I first creat MenuItem() object, and then add it in menu.
but the sample creat and add at the same time as:

testMenu.add(tmp = new MenuItem("New Window", document.location.href));

 




Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX