Forum Moderators: open
I have one website and I set up JavaScript Menu in template
in this template i am generating menu by javascript its generating fine with 800 x 600 Screen Resolution but when it comes to 1024 x 768 then its not working
i am calling .js file from body part in my html page so is there any condition in HTML with
if Screen Resolution = 800 x 600 then
call file 1
else
call file 2
endif
I want this menu at right place in any Screen Resolution.
Plz Guide me its Urgent
Thanks in Advance
If you can show me some code then I will be very grateful to you here is my code for HTML Document from where i am calling this files
-----------------------------------------------------------
<link rel="stylesheet" href="menu.css">
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<script language="JavaScript" src="menu.js"></script>
<!-- items structure. menu hierarchy and links are stored there -->
<script language="JavaScript" src="menu_items.js"></script>
<!-- files with geometry and styles structures -->
<script language="JavaScript" src="menu_tpl.js"></script>
<script language="JavaScript">
<!--//
// Note where menu initialization block is located in HTML document.
// Don't try to position menu locating menu initialization block in
// some table cell or other HTML element. Always put it before </body>
// each menu gets two parameters (see demo files)
// 1. items structure
// 2. geometry structure
new menu (MENU_ITEMS, MENU_POS);
// make sure files containing definitions for these variables are linked to the document
// if you got some javascript error like "MENU_POS is not defined", then you've made syntax
// error in menu_tpl.js file or that file isn't linked properly.
// also take a look at stylesheets loaded in header in order to set styles
//-->
</script>
----------------------------------------------------------------
In menu_tpl.js file there is code that where this menu should be displayed its work in 800 x 600 but not in 1024 x 768 so plz guide me how can i do it with all resolution or just show me with both this resolution
Waiting for your reply.
thanks in advance
How is the menu integrated with your HTML document? The problem may not be to do with the menu scripts themselves, but with the way it is implemented into your page and your own CSS(?)
It seems the menu script you are using is really designed for a fixed, absolutely positioned layout.
You do not seem to use CSS anywhere in your page layout (only the menu), relying on a <table> to position things and <center> and <div> container tags to centre things. This would need to change if you wanted to keep your centred layout with your menu in the correct place, together with where you make the JavaScript call (
new menu (MENU_ITEMS, MENU_POS);) to initialise your menu in the first place (currently at the top of the body).
The absolute positioning of the menu items is hard coded in
menu.js, search for "
position: absolute;", and is written out for each menu item - this *may* need to change, possibly to "
position: relative;" (but would depend on your HTML markup).
Currently, the left position of your menu is defined in
menu_tpl.js, search for "
'block_left': 7,".
HHhhhmmm... So, it looks like there are quite a few things that need to change in different files to get it to work how you want. To be honest, I think your best bet short term, is to simply lose your centred layout and have it all positioned on the left (hey, BBC.co.uk do ok for themselves). To remove centering, remove the following lines from your HTML markup...
<div align="center">
<center>
:
(Leave the TABLE as it is)
:
</center>
</div>
The menu should then work for all resolutions, but your page is not centred. (?!)