users@javaserverfaces.java.net

Re: getting X,Y cordinate of h:graphicImage

From: Jason Lee <jason_at_steeplesoft.com>
Date: Thu, 14 Jun 2007 15:28:48 -0500

On 6/14/07, Nishant <katoch.nishant_at_gmail.com> wrote:
>
> but when I implement JSF then its giving wrong result.
> -------------SEE JSF IMPLEMENTATION------------------
> <a4j:commandLink id="imgVideo">
> <h:graphicImage id="Imgpic" url="img/#{studio.image}"
> onmouseover="drawImage2(this.offsetLeft,this.offsetTop)"/>
> </a4j:commandLink>
> THIS ALWAYS GIVES ME CO-ORDIANTES AS x=1 and y=1 .
> ---------------------------
>

I don't have an a4j environment set up, but when I do this:

<h:form>
        <h:commandLink id="imgVideo">
            <h:graphicImage id="Imgpic" url="download.jpg"
onmouseover="alert(this.offsetLeft + ' ' + this.offsetTop)"/>
        </h:commandLink>
</h:form>

I get "5 208". For what that's worth.

-- 
Jason Lee, SCJP
Software Architect -- Objectstream, Inc.
JSF RI Dev Team
http://blogs.steeplesoft.com