A DHTML Problem !!

Discussion in 'ASP .Net' started by MingChih Tsai, Mar 17, 2005.

  1. Dear All,

    How should I do if I want to get the left offset value of the button
    2 !!

    Thanks a lot !!

    code as following .....

    <HTML>

    <HEAD>
    <script language="javascript">
    function test(e)
    {
    alert (e.offsetLeft);
    }
    </script>
    </HEAD>

    <body>
    <form id="form1" method="post" runat="server">
    <P></P>

    <P> </P>
    <P></P>

    <P> <INPUT id="Button1" type="button" value="Button1" name="Button1"
    onclick="javascript:return test(this)"></P>
    <P> </P>
    <P>
    <TABLE width="500" align="center" border="1" ID="Table1">
    <TR>
    <TD style="WIDTH: 245px" width="245">test</TD>
    <TD width="500"><INPUT id="Button2" type="button" value="Button2"
    name="Button2" onclick="javascript:return test(this)"></TD>
    </TR>
    </TABLE>
    </P>
    </form>
    </body>
    </HTML>
     
    MingChih Tsai, Mar 17, 2005
    #1
    1. Advertising

  2. MingChih Tsai

    Curt_C [MVP] Guest

    I'd suggest a javascript group, not a server based technology one.

    --
    Curt Christianson
    Site & Scripts: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "MingChih Tsai" <> wrote in message
    news:...
    > Dear All,
    >
    > How should I do if I want to get the left offset value of the
    > button
    > 2 !!
    >
    > Thanks a lot !!
    >
    > code as following .....
    >
    > <HTML>
    >
    > <HEAD>
    > <script language="javascript">
    > function test(e)
    > {
    > alert (e.offsetLeft);
    > }
    > </script>
    > </HEAD>
    >
    > <body>
    > <form id="form1" method="post" runat="server">
    > <P></P>
    >
    > <P> </P>
    > <P></P>
    >
    > <P> <INPUT id="Button1" type="button" value="Button1" name="Button1"
    > onclick="javascript:return test(this)"></P>
    > <P> </P>
    > <P>
    > <TABLE width="500" align="center" border="1" ID="Table1">
    > <TR>
    > <TD style="WIDTH: 245px" width="245">test</TD>
    > <TD width="500"><INPUT id="Button2" type="button" value="Button2"
    > name="Button2" onclick="javascript:return test(this)"></TD>
    > </TR>
    > </TABLE>
    > </P>
    > </form>
    > </body>
    > </HTML>
    >
    >
     
    Curt_C [MVP], Mar 17, 2005
    #2
    1. Advertising

  3. MingChih Tsai

    bruce barker Guest

    offset from what? offsetLeft is the childs offset from its parent, in you
    case the left offset from the <P>.

    -- bruce (sqlwork.com)


    "MingChih Tsai" <> wrote in message
    news:...
    | Dear All,
    |
    | How should I do if I want to get the left offset value of the
    button
    | 2 !!
    |
    | Thanks a lot !!
    |
    | code as following .....
    |
    | <HTML>
    |
    | <HEAD>
    | <script language="javascript">
    | function test(e)
    | {
    | alert (e.offsetLeft);
    | }
    | </script>
    | </HEAD>
    |
    | <body>
    | <form id="form1" method="post" runat="server">
    | <P></P>
    |
    | <P> </P>
    | <P></P>
    |
    | <P> <INPUT id="Button1" type="button" value="Button1" name="Button1"
    | onclick="javascript:return test(this)"></P>
    | <P> </P>
    | <P>
    | <TABLE width="500" align="center" border="1" ID="Table1">
    | <TR>
    | <TD style="WIDTH: 245px" width="245">test</TD>
    | <TD width="500"><INPUT id="Button2" type="button" value="Button2"
    | name="Button2" onclick="javascript:return test(this)"></TD>
    | </TR>
    | </TABLE>
    | </P>
    | </form>
    | </body>
    | </HTML>
    |
    |
     
    bruce barker, Mar 17, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Smith
    Replies:
    5
    Views:
    55,949
    altamir
    Dec 18, 2003
  2. mark | r
    Replies:
    4
    Views:
    604
    Toby Inkster
    Sep 2, 2004
  3. sturkel
    Replies:
    1
    Views:
    463
    Bernhard Sturm
    Aug 22, 2007
  4. sturkel
    Replies:
    7
    Views:
    627
    Beauregard T. Shagnasty
    Aug 22, 2007
  5. Steve
    Replies:
    1
    Views:
    294
    Richard Cornford
    Apr 9, 2005
Loading...

Share This Page