Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- var defaultMenubarWidth = 1077;
- var browserWidth;
- var browserHeight;
- function debugout( stuff )
- {
- //document.getElementById('output').innerHTML = document.getElementById('output').innerHTML + stuff + "<br>";
- document.getElementById('output').innerHTML = 'stuff2';
- }
- function layoutMenubar()
- {
- debugout( "BLA" );
- var allDivs = document.getElementsByTagName('div');
- var topItems = new Array();
- var bottomItems = new Array();
- var topIndex = 0;
- var bottomIndex = 0;
- for( i = 0; i < allDivs.length; i++ )
- {
- debugout( "searching for top" + topIndex );
- if( allDivs[ i ].id === ( "top" + topIndex ) )
- {
- document.write( "found top" + topIndex);
- topItems[ topIndex ] = allDivs[ i ];
- topIndex++;
- }
- else if( allDivs[ i ].id === ( "bottom" + bottomIndex ) )
- {
- bottomItems[ bottomIndex ] = allDivs[ i ];
- bottomIndex++;
- }
- }
- layoutMenubarLayer( topItems );
- layoutMenubarLayer( bottomItems );
- }
- function layoutMenubarLayer( items )
- {
- for( i = 0; i < items.length; i++ )
- {
- items.style.width = ( browserWidth / defaultMenubarWidth ) * ( defaultMenubarWidth / items.length ) -
- items.style.border-width * items.length;
- }
- }
- function getBrowserWidth()
- {
- if( typeof window.innerWidth != 'undefined' )
- {
- browserWidth = window.innerWidth;
- browserHeight = window.innerHeight;
- }
- else if( typeof document.documentElement != 'undefined' &&
- typeof document.documentElement.clientWidth != 'undefined' &&
- document.documentElement.clientWidth != 0 )
- {
- browserWidth = document.documentElement.clientWidth;
- browserHeight = document.documentElement.clientHeight;
- }
- else
- {
- browserWidth = document.getElementsByTagName('body')[ 0 ].clientWidth;
- browserHeight = document.getElementsByTagName('body')[ 0 ].clientHeight;
- }
- }
- window.onLoad = function()
- {
- debugout( "BLA" );
- getBrowserWidth();
- layoutMenubar();
- body.onResize = function()
- {
- getBrowserWidth();
- layoutMenuBar();
- }
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement