Results 1 to 2 of 2
  1. #1

    Lightbulb Javascript Resets CSS Positioning

    I have a javascript function that changes the width and display of a div, however once it changes the width it seems to reset the css positioning and moves the div to the top center of the browser. Can anyone tell me why? See below code:
    HTML Code:
    	<div id="topNav">
    			<li name="navItem"><a onmouseover="showLogin('loginWindow');" href="<? print $site->url['billing']; ?>">Client Services</a></li>
    		<div id="loginWindow">
    			<div id="loginWindow2">
    				<form action="script.php?action=login" method="post" enctype="multipart/form-data" name="clientLogin" target="_self">
    					<input name="Submit" type="submit" value="Submit" />
    PHP Code:
    function showLogin(obj) {
    width 0;
    objects document.getElementsByName('navItem');
        for (var 
    i=0,x=objects.lengthi<xi++) width += objects[i].getElementsByTagName('*')[0].offsetWidth;
    document.getElementById(obj).style.width width 'px';
    //document.getElementById(obj).style.position = 'relative';
        //document.getElementById(obj) = '-17px';
        //document.getElementById(obj).style.right = '85px';
    document.getElementById(obj).style.display 'block';

    I tried repositioning with position, top and right (commented out above), but that did not work.
    div#topNav div#loginWindow {float: right; display: none; position: relative; margin: 0px; padding: 0px; top: -17px; right: 85px; z-index: 999;}
    div#topNav div#loginWindow div#loginWindow2 {position: absolute; top: 0; right: 0; width: inherit; background-color: #47515d; border: 3px solid #ffffff; text-align: left;}
    div#topNav div#loginWindow div#loginWindow2 form {margin: 10px;}
    div#topNav div#loginWindow div#loginWindow2 form a {color: #ffffff; margin-top: 10px;}
    Does anyone know why this is happening?

  2. #2
    Disregard. It was a CSS error. Issue is now fixed.

Similar Threads

  1. CSS Float Positioning
    By L-A-N in forum Web Design and Content
    Replies: 10
    Last Post: 06-03-2008, 04:05 PM
  2. Help with Navigation Positioning(CSS)
    By YBHosting in forum Web Design and Content
    Replies: 6
    Last Post: 06-29-2007, 10:45 AM
  3. CSS Positioning Help
    By oonth in forum Web Design and Content
    Replies: 1
    Last Post: 04-17-2006, 01:58 AM
  4. css positioning
    By bFan in forum Web Design and Content
    Replies: 1
    Last Post: 02-26-2005, 06:43 PM
  5. HTML Anchor Positioning / Javascript
    By ijg0 in forum Programming Discussion
    Replies: 1
    Last Post: 09-04-2003, 12:24 PM

Posting Permissions

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