Positioning DHTML Menu


Trial User
1 post

Ok so I created some menu's using the menu builder software.

I then saved the code in a file called menu.js in the scripts folder to save having to repeat all the code on every page.

I can't figure out how to call the menu's up in the page though.

Also even when I do paste the code straight in I can't control the position of the menu's, could someone help me find what what to change to get them to display within a menu div.


Ambassador
3,257 posts

Hi Tirvine24,
Would you possibly have a link to post so we may see what you have and the code? thanks "It's A Smart Person That Asks"
"If I can bend over to lift the seat-she can bend over to put it down"





Senior Advisor
3,144 posts

tirvine24,

Some DHTML Menu builder helps can be found here: http://www.coffeecup.com/free-dhtml/help/

More helps are found here: http://www.coffeecup.com/help/articles/ … nu+Builder

To call the menus, you have started correctly by saving the code as a .js file. Now to call that menu, use something like this:
<SCRIPT type="text/javascript" SRC="/script/menu.js"></SCRIPT>

If it still does not display, make sure you save the correct portions of the code. The first line should be: function Go(){return}
the last line should be: function AfterCloseAll(){return}

Positioning the menu is not difficult if you use a span to control the menu position. The final code for you pages would then look something like this:
<span id="themenu">
<SCRIPT type="text/javascript" SRC="/script/menu.js"></SCRIPT>
</span>

AND you must make a change to the menu code to link the code to the span. Look at6 your menu.js and you will find a line in the top section that reads:
var TargetLoc='';
Change that line to read:
var TargetLoc='themenu';

You mentioned placing the menu inside a div statement. I use a div statement with an id and then position the div using CSS. An example would be <div id="menu"> insert menu code as above </div>

Then in the css file use whatever positioning styles you want to use, such as:
#menu { padding: 0px;
float: left;
width: 170px;
height:300px;
}

That CSS is something I use on a vertical menu that I keep to the left side of the page.

If you have questions, be sure to ask, and if at all possible, as Bruzer asked, include a link to the page.
Bill R.
First Baptist Church
Brighter Day Charities
Roberson Family


Trial User
3 posts

Hi

I'm having similiar problem, the menu floats, I have tried inserting <span id> and </span> and the TargetLoc I don't know what to insert, as mymenu is not the name of my menu. I create a menu in coffeecup free menu builder copy the code into my website (limited skill level).

www.finngrandfest2010.com

Any suggestions would be great. Shirley


Ambassador
1,027 posts

Not 100% certain... But I believe this line

var MenuVerticalCentered='static'; // Menu vertical position 'top', 'middle','bottom' or static

should be 'top' instead of 'static'.

You might try that while we await 'expert' opinion. Good Luck! http://hillbillyaviation.com


Ambassador
3,257 posts

maybe this can help her Phil.
http://kellyinfo.com/MyFiles/tutorials/DHTMLSPAN.htm
sorry that ones stops in the middle I guess you could try
http://kellyinfo.com/web/teerye.jpg
and adjust it accordingly

or this http://www.coffeecup.com/free-dhtml/ "It's A Smart Person That Asks"
"If I can bend over to lift the seat-she can bend over to put it down"





Trial User
3 posts

Hi
Thank you for response,

Top would put it right to the top of the page, which I don't want as I have a banner picture on each page. I need it to be underneath that and stay in that location if an viewer scrolls downward on the web page

Static is the root problem, but in coffeecup there is static, top, I read coffeecup menu builder is "static" and not relative, but it seems that somehow the TargetLoc and <Span> will provide solution but don't know exactly how.
Bruzer I get NOT Found on your hyperlink


Ambassador
3,257 posts

hold I'll fix it-should work now! sorry "It's A Smart Person That Asks"
"If I can bend over to lift the seat-she can bend over to put it down"





Senior Advisor
3,144 posts

Shoily,

It does not matter how you have named your menu since you are including the complete code in your page.

Static means that as you scroll down a page, the menu will stay in about the same position. I suggest you select top and then set the menu code to stay where you want it. I will give specific examples copied from you page.

First, look in the code for the menu and find this line:
var TargetLoc=''; // span id for relative positioning
Now change it to read:
var TargetLoc='themenu'; // span id for relative positioning

Next locate at the very top of your menu code this line:
<script type='text/javascript'>
Now change that line to read:
<span id="themenu"><script type='text/javascript'>

Now go to the bottom of your menu code and locate these lines:
</script>
<noscript>Your browser does not support script</noscript>
Change these to read:
</script></span>
<noscript>Your browser does not support script</noscript>

With those changes, the menu should stay where you put it based on the code generated by your editors absolute positioning.
Bill R.
First Baptist Church
Brighter Day Charities
Roberson Family


Trial User
3 posts

Hello,

Excellent, Thank you so very much, it works. I didn't realize themenu is I guess a filler and not actually a file name and I original thought Top meant right to the extreme top of the web page.

A bit of trial and error, I needed to really go into the negative numbers to get the StartTop and StartLeft positioned.

The final question for awhile is, I have 20 separate pages, is there a command that I could add on the index.html to repeat the menu on each page or is that too much to ask?

Thank you very much
Shirley (Shoily)

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.