473,395 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

get some info using javascript

hi,

i am looking for object properties, that holds these informations:

- position of object - distance from top and left window border
- width and height of object - i was looking for this, and i found
clientWidth, it works in IE and Firefox, please tell me, if you have
something better.. it also works like document.body.clientWidth, so i
can get width of window

i am newbie, so be patient, thx

i need it to work in most browsers

Jan 3 '07 #1
5 919
zero0x said the following on 1/3/2007 11:54 AM:
hi,

i am looking for object properties, that holds these informations:

- position of object - distance from top and left window border
<URL: http://www.javascripttoolbox.com/lib/objectposition/>
- width and height of object - i was looking for this, and i found
clientWidth, it works in IE and Firefox, please tell me, if you have
something better.. it also works like document.body.clientWidth, so i
can get width of window
<URL: http://www.javascripttoolbox.com/lib/objectposition/>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 3 '07 #2
this is very nice, and usable, but i was looking for something
simplier. i can use library, there isnt any problem, its just i tought
this would be just a propertie.

thx v3ry mch

Jan 3 '07 #3
zero0x said the following on 1/3/2007 1:28 PM:
this is very nice, and usable, but i was looking for something
simplier. i can use library, there isnt any problem, its just i tought
this would be just a propertie.
It is, and the property is different in different browsers and even then
it measures offsets differently. The library covers all of that (or as
much as possible). So, you can use the library or end up writing your
own. The library is a lot simpler.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 3 '07 #4
i found this code

function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
curleft = obj.offsetLeft
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft
curtop += obj.offsetTop
}
}
return [curleft,curtop];
}

and i think it is better, what you think?

Jan 7 '07 #5
zero0x said the following on 1/7/2007 12:54 AM:

Please quote what you are replying to.
i found this code
Put it back where you found it.
function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
curleft = obj.offsetLeft
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft
curtop += obj.offsetTop
}
}
return [curleft,curtop];
}

and i think it is better, what you think?
I think we have a difference of opinion on which is better code, that or
Matt's library.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 7 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: yabba | last post by:
How can I differentiate 2 windows on the same machine opened to the same .asp session??? Client-side Javascript is fine and I don't need to worry about anyone defeating it. I info as to *HOW*...
2
by: esrkq | last post by:
Hi, I am looking at a way to return IP related information of a visitor loading a web page and found the following snippet of code: if(navigator.javaEnabled() && (navigator.appName !=...
6
by: KKramsch | last post by:
OK, here's the scenario: I have a CGI script that generates a page with frames (BTW, I'm not crazy about frames, but in this case the decision to use them is out of my hands). In a typical...
3
by: marslee | last post by:
I want to change a webpage so that when i move the mouse to certain area of the page, the info tip tell what the content is about. It's like moving the mouse in the desktop's my documment, when you...
2
by: Chris Tillotson | last post by:
Hello, I just wanted to suggest this as an idea and get feedback if it is a lame. I had a simple challenge. In my app a client can upload a file and it took a while and I wanted to indicate to the...
5
by: Jozef | last post by:
Hello, I have done a little "old" ASP work along with some javascript. I'm currently getting into ASP.net and would like to step up my game overall with regard to Web Development. I was...
20
by: Tim Reynolds | last post by:
Team, I am developing a web service. In testing in on my enw PC, I am expecting to see exceptions thrown appear on my browser. Instead I am getting an HTTP 500 Internal Server Error page and I am...
2
by: Bob | last post by:
I know how to use php/mysql, but the html aspect of what Im trying to do (if its even possible this way) is what Im unsure of. I want to have a button that a user can hit to valid mysql info...
3
by: Jeff | last post by:
I know how to use php/mysql, but the html aspect of what Im trying to do (if its even possible this way) is what Im unsure of. I want to have a button that a user can hit to valid mysql info...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.