Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Thu, 24 Apr 2008 06:46:25 -0700,    group: microsoft.public.inetsdk.programming.html_objmodel        back       


currentStyle Object   
I am trying to use the currentStyle object to retrieve the position of a div 
that is defined in an external style sheet as:

#info div {
	position: absolute;
	left: 340px;
	top: 375px; /* position of balloon pop-up */
	z-index: 100; }

Using:

 var elemID = 'info';
 var elem = document.getElementById(elemID);
  if (elem.currentStyle) {
        top = elem.currentStyle.top;
        left = elem.currentStyle.left;
  }

always returns "auto" and not the pixel positions. Why?
date: Thu, 24 Apr 2008 06:46:25 -0700   author:   Chevron7

Re: currentStyle Object   
"Chevron7"  wrote in message
news:30AAB772-FF19-448F-985E-6E4445560855@microsoft.com
> I am trying to use the currentStyle object to retrieve the position
> of a div that is defined in an external style sheet as:
>
> #info div {
> position: absolute;
> left: 340px;
> top: 375px; /* position of balloon pop-up */
> z-index: 100; }
>
> Using:
>
> var elemID = 'info';
> var elem = document.getElementById(elemID);
>  if (elem.currentStyle) {
>        top = elem.currentStyle.top;
>        left = elem.currentStyle.left;
>  }
>
> always returns "auto" and not the pixel positions. Why?

"#info div" means "all <div> elements that are descendants (direct or 
indirect) of an element whose id is 'info' ". It does not mean, as you 
seem to assume, "an element with an id of 'info' which also happens to 
be a <div> ". That would have been div#info
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Thu, 24 Apr 2008 16:06:30 -0400   author:   Igor Tandetnik

Re: currentStyle Object   
Thanks for catching that; I don't know how I overlooked that ... a bit of 
dyslexia I guess. With that correction the object is now working as it should.

"Igor Tandetnik" wrote:

> "Chevron7"  wrote in message
> news:30AAB772-FF19-448F-985E-6E4445560855@microsoft.com
> > I am trying to use the currentStyle object to retrieve the position
> > of a div that is defined in an external style sheet as:
> >
> > #info div {
> > position: absolute;
> > left: 340px;
> > top: 375px; /* position of balloon pop-up */
> > z-index: 100; }
> >
> > Using:
> >
> > var elemID = 'info';
> > var elem = document.getElementById(elemID);
> >  if (elem.currentStyle) {
> >        top = elem.currentStyle.top;
> >        left = elem.currentStyle.left;
> >  }
> >
> > always returns "auto" and not the pixel positions. Why?
> 
> "#info div" means "all <div> elements that are descendants (direct or 
> indirect) of an element whose id is 'info' ". It does not mean, as you 
> seem to assume, "an element with an id of 'info' which also happens to 
> be a <div> ". That would have been div#info
> -- 
> With best wishes,
>     Igor Tandetnik
> 
> With sufficient thrust, pigs fly just fine. However, this is not 
> necessarily a good idea. It is hard to be sure where they are going to 
> land, and it could be dangerous sitting under them as they fly 
> overhead. -- RFC 1925 
> 
> 
>
date: Thu, 24 Apr 2008 16:39:13 -0700   author:   Chevron7

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us