www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] function works in FF but not IE

  1. #1
    Join Date
    Nov 2007
    Posts
    194

    resolved [RESOLVED] function works in FF but not IE

    This function works fine in FF but doesn't do anything in IE (no errors either)...any ideas why?

    Code:
    function widthFind(){
    	var width=document.width;	
    	var widthHead=994;
    	newWidth=0;	
    	if(width>widthHead)
    	{
    		newWidth=(width-widthHead)/2;
    	}
    	document.getElementById('menuContinue').style.width=newWidth+"px";
    }

  2. #2
    Join Date
    May 2006
    Location
    Odenton, MD
    Posts
    1,449
    code use non-standard property like document.width

  3. #3
    Join Date
    Nov 2007
    Posts
    194
    so what would be a cross-browser way of finding the window's width?

  4. #4
    Join Date
    May 2006
    Location
    Odenton, MD
    Posts
    1,449
    you can't determine the width or height of the window per se. however, you can read the width or height of browser's canvas (the area where web content are rendered). using standard method would require you to double the code specially for msie browsers. so, the short version, which i think isn't standard but work on msie and fx (had not tried on webkit engine). document.documentElement.scrollWidth and scrollHeight.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles