DHTML
i have a problem, i have the script for a DHTML menu that i would like to use twice on one page, i have tried many things but the second menu never shows up, i will post the code below, can anyone help me?
<script language="JavaScript" src="navcond.js"></script>
<script language="JavaScript">
var myNavBar = new NavBar(135);
myNavBar.setSizes(3, 5, 1);
var tempMenu;
myNavBar.setColors("#FA7803", "#FFFFFF", "#FA7803", "#FFFFFF", "#004080", "#000000", "#FFFFFF", "#FFFFFF", "#004080");
myNavBar.setFonts("Verdana, Arial", "plain", "bold", "9pt", "Verdana, Arial", "plain", "plain", "9pt") ;
myNavBar.setAlign("left");
tempMenu = new NavBarMenu(0, 130);
tempMenu.addItem(new NavBarMenuItem("Menu", ""));
tempMenu.addItem(new NavBarMenuItem("Free Goodies", "http://www."));
tempMenu.addItem(new NavBarMenuItem("Topsites", "blank.html"));
tempMenu.addItem(new NavBarMenuItem("Banner Exchange", "http://www.doubleok.com/cgi-bin/banner_exchange.pl"));
tempMenu.addItem(new NavBarMenuItem("Search Engine", "blank.html"));
tempMenu.addItem(new NavBarMenuItem("Redirection URL", "http://www.doubleok.com/cgi-bin/redirect.pl"));
tempMenu.addItem(new NavBarMenuItem("E-mail Forwarding", "blank.html"));
tempMenu.addItem(new NavBarMenuItem("Auctions", "blank.html"));
tempMenu.addItem(new NavBarMenuItem("Classifieds", "blank.html"));
tempMenu.addItem(new NavBarMenuItem("Newsboard", "blank.html"));
tempMenu.addItem(new NavBarMenuItem("Forums", "http://www."));
myNavBar.addMenu(tempMenu);
function init() {
var img;
myNavBar.create();
// Find the position of the embedded image and move bar accordingly, note
// that we have to adjust for the table's cell padding.
img = getImage("placeholder");
myNavBar.moveTo(getImagePageLeft(img) - 2, getImagePageTop(img) - 2);
}
</script>
richjb posted this at 15:38 — 4th July 2000.
They have: 193 posts
Joined: Feb 2000
For someone to be able to see the above coe work, they will need to create a img named placeholder.
[just noticed that]
Richard
[Edited by richjb on 07-04-2000 at 11:43 AM]
[email protected]
Everyone here has a website. It's just that not all are worth posting (Mine! ).
Vincent Puglia posted this at 23:03 — 4th July 2000.
They have: 634 posts
Joined: Dec 1999
Hi Richard,
Don't know if I answered this in another forum, but in all likelihood, your problem is related to "hardwiring", especially if the script came dynamicdrive, javascript source, or wsabstract's script pages. Hardwiring happens when there are a lot of global variables, a minimum of parameter passing, and an excessive use of names. Such scripts are written to be used alone on a page.
Your options:
1) recopy the entire script into your html page for each menu you wish to use -- and rename every function and global variable. You can append a "2" for the renaming. Make sure you change the mouseovers or whatever.
2) get another script
3) rewrite the script
Vinny
Where the world once stood
the blades of grass cut me still
Lloyd Hassell posted this at 16:42 — 7th July 2000.
They have: 231 posts
Joined: Feb 2000
Looks like a script from Brainjar. What you need to do is create a second instance of the NavBar object.
var myNavBar2 = new NavBar(135);
Then set all the properties just like you did with the first one. If this does not work then you will have to sift through each line of code most likely.
Why don't you make your own from scratch?
:: Lloyd Hassell :: http://www14.brinkster.com/lloydh ::
Anonymous posted this at 17:22 — 7th July 2000.
They have: 5,633 posts
Joined: Jan 1970
i may try it, but i am not very good
Vincent Puglia posted this at 11:48 — 9th July 2000.
They have: 634 posts
Joined: Dec 1999
Hi,
Better to learn now than later. And don't worry about being good, just get in there are whip that spaghetti code to shape. If you have a specific question about a specific line or lines of code, I'll try to help.
Vinny
Where the world once stood
the blades of grass cut me still
Anonymous posted this at 14:00 — 9th July 2000.
They have: 5,633 posts
Joined: Jan 1970
ok, sounds like i better try, thank you for your offer to help me, it is very generous!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.