Forum Moderators: open

Message Too Old, No Replies

JavaScript HTML Help - Plz Guide its URGENT

         

a1domain

10:51 am on Sep 26, 2006 (gmt 0)

10+ Year Member



Hello Big Brothers

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

penders

11:56 am on Sep 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you have two separate menus... one for 800x600 and another for 1024x768 ...? (The reason behind your IF statement) Surely you should have just one that copes with them all, as there are any number of screen resolutions / window sizes.

Would need to see some code...

a1domain

12:18 pm on Sep 26, 2006 (gmt 0)

10+ Year Member



Thanks penders

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

RonPK

1:13 pm on Sep 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



a1domain, could you please show the code that determines which script is to be loaded?

penders

2:50 pm on Sep 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi a1domain, the code you have posted above does not help towards solving the problem... all it does is include a bunch of JavaScript files which could contain 'anything'?! Does the source of the scripts not provide any support? What about the 'demo files'?

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(?)

penders

10:52 am on Sep 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The problem is that each menu item is positioned absolutely (position:absolute;) on your page, but the rest of your page is centred. The menu always appears hard over to the left (regardless of resolution).

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. (?!)