Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need to center flash menu.

    Hi,
    I have a program that built me a flash menu, but it doesen't have a function to center it. I want the menu to be centered at the very top of the page, my coding skills are too limited for this. I hope someone here can help.

    View the code online:

    http://znasimov.tripod.com/the_file/Code.txt

    Thanks in advance.
    Last edited by The_Table_File; 03-09-2009 at 05:23 AM. Reason: Wana attach text file with code...

  • #2
    New Coder
    Join Date
    Jan 2009
    Posts
    59
    Thanks
    2
    Thanked 1 Time in 1 Post
    why dont you just create a div and place it in that ... ?


    Code:
    <html>
    <body>
    <div id="flashmenu">
    function AdjustMenu(pobjName,pblnCenter,pintLeft,pintTop) {
    var w_newWidth,padding,xoffset;
    
      if (navigator.appName.indexOf("Microsoft") != -1) {
      	w_newWidth=(document.documentElement.clientWidth == 0)?document.body.clientWidth:document.documentElement.clientWidth;
      	xoffset=21;
      }else{
      	w_newWidth=document.documentElement.clientWidth;
      	xoffset=17;
    	} 	  
    	if (pblnCenter=='true'){
    		document.getElementById(pobjName).style.left=(w_newWidth-parseInt(document.getElementById(pobjName).style.width))/2+'px';
    	}else{
    		padding=parseInt((window.screen.width-xoffset-parseInt(document.getElementById(pobjName).style.width))/2-pintLeft);    		
    		document.getElementById(pobjName).style.left=(w_newWidth-parseInt(document.getElementById(pobjName).style.width))/2-padding+'px';
    	}
    	if (parseInt(document.getElementById(pobjName).style.left)<0) 
    		document.getElementById(pobjName).style.left='0px';
    	document.getElementById(pobjName).style.top=pintTop+'px';      		
    }
    </div>
    </body>
    </html>
    then for the css

    Code:
    #flashmenu {
    margin: 0 auto;
    width:how ever many pixles;
    height: how ever many pixles;
    }

  • #3
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Big thanks.

    Thank you very much, but there seems to be a syntax erron in row 5, the main code, not the cascading style sheets.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •