473,396 Members | 2,002 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,396 software developers and data experts.

offset top calculation problem

If I have a button defined as:
<input type="button" name="zzz">

I can determine the top position using the function getOffsetTop below
like:
var tableTop = getOffsetTop(zzzz); //and I get a valid
value

However if I have another function involved where the button name is
being passed to it I'm having a problem not knowing how to call this.

onclick=temp(zzzz);

function temp(mybutton)
{
var tableTop = getOffsetTop(mybutton);
}

function getOffsetTop (el)
{
var ot = el.offsetTop;
while ( ( el = el.offsetParent ) != null )
{
ot += el.offsetTop;
}
return ot;
}

Jul 20 '05 #1
1 5023
I'm sorry I didn't mean a button, I meant a link

Michael Hill wrote:
If I have a button defined as:
<input type="button" name="zzz">
should have been:

<a href="javascript:some_script();" id="zzz"><img
src="image_here"></a>


I can determine the top position using the function getOffsetTop below
like:
var tableTop = getOffsetTop(zzzz); //and I get a valid
value

However if I have another function involved where the button name is
being passed to it I'm having a problem not knowing how to call this.

onclick=temp(zzzz);

function temp(mybutton)
{
var tableTop = getOffsetTop(mybutton);
}

function getOffsetTop (el)
{
var ot = el.offsetTop;
while ( ( el = el.offsetParent ) != null )
{
ot += el.offsetTop;
}
return ot;
}


Jul 20 '05 #2

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

Similar topics

9
by: BaWork | last post by:
I'm using the following code to calculate order amount in a payment form for Authorize.net: (Assume book_copies = 1 and ship_country = United States) book_copies = request ("book_copies")...
9
by: chris vettese | last post by:
On my subform I have a field in the footer that totals the value of a field. On the main form I have referenced this field. I'm using this field in a calculation on my main form. The problem...
5
by: Aravind | last post by:
Hi folks. I have a form, frmHistory, that has the following code for its On Open event. =-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-= Private Sub Form_Open(Cancel As Integer) ...
1
by: Maor Mishkin | last post by:
Hello All, I have a calculation problem, the system changes it's accuracy during the program, attached is a sample with the bug, you can compile it and run it in debug mode, then look at the...
1
by: Gas | last post by:
I am new to C#, I want to perfoem a calculation and I have a weird out come from the app. Here is the code double percentage = 0; percentage = ctrl1.Height / (ctrl1.Height+ ctrl2.Height) ...
6
by: gsb58 | last post by:
Hi! Recently we, in Norway changed to three different VAT levels. All three needs to be on the invoice program. This is easy obtained via a new field and set the rowsource to valuelist and make...
3
by: mattmao | last post by:
Okay, I was asked by a friend about the result of this limit: http://bbs.newwise.com/attdata/forumid_14/20070922_fe7f77c81050413a20fbDWYOGm7zeRj3.jpg Not n->zero but n-> + infinite I really...
1
by: jesmi | last post by:
hi, i have a problem in limit and offset with asc and desc i tried the following code: select * from tbl_name order by column_name asc limit 10 offset 15 it shows the 10 rows starting from...
6
by: jenniferhelen | last post by:
I am having a problem with a calculation in Microsoft Access. I am trying to add two numeric columns, however the result I am receiving is the data is being concatenated. I am using the following...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.