Windows Vista Forums

Who triggered my event?

  1. #1


    samwyse Guest

    Who triggered my event?

    I've got a script that uses IE for its GUI. When I generate the
    document body, I've got an open-ended set of images with onclick
    properties. When any image is clicked, the script needs to know which
    image was triggered.

    Right now, I have this:

    for i = 1 to count
    strHTML = strHTML & "<IMG ID=""IMG" & i & """ SRC=""" + image[i]+
    """><BR>"
    next i
    objExplorer.Document.Body.InnerHTML = strBefore & strHTML & strAfter

    And a bit later, I have this:



    for i = 1 to count
    Set objTemp = objExplorer.document.getElementById("IMG"&i)
    Set objTemp.onclick = GetRef("ClickedOnImage")
    next i

    How can my ClickedOnImage routine know which button was clicked?
    Thanks!

      My System SpecsSystem Spec

  2. #2


    Tom Lavedas Guest

    Re: Who triggered my event?

    On May 20, 4:09 pm, samwyse <samw...@xxxxxx> wrote:

    > I've got a script that uses IE for its GUI. When I generate the
    > document body, I've got an open-ended set of images with onclick
    > properties. When any image is clicked, the script needs to know which
    > image was triggered.
    >
    > Right now, I have this:
    >
    > for i = 1 to count
    > strHTML = strHTML & "<IMG ID=""IMG" & i & """ SRC=""" + image[i]+
    > """><BR>"
    > next i
    > objExplorer.Document.Body.InnerHTML = strBefore & strHTML & strAfter
    >
    > And a bit later, I have this:
    >
    > for i = 1 to count
    > Set objTemp = objExplorer.document.getElementById("IMG"&i)
    > Set objTemp.onclick = GetRef("ClickedOnImage")
    > next i
    >
    > How can my ClickedOnImage routine know which button was clicked?
    > Thanks!
    set oSrc = objExplorer.document.parentWindow.event.srcElement
    wsh.echo oSrc.ID, oSrc.Name, oSrc.Value

    Tom Lavedas
    ===========
    http://members.cox.net/tglbatch/wsh/

      My System SpecsSystem Spec

Who triggered my event?

Similar Threads
Thread Thread Starter Forum Replies Last Post
CAPI2 Event 11 and Event 30 and Event 82 Errors Ken Vista General 0 09 Oct 2009
Quickplay triggered by games? LAB Enterprises Vista General 1 29 Mar 2008
Solution to Deal with the weird character triggered delete Fabrice Live Folder Share 7 08 Dec 2007
Windows Vista restart loop- Triggered by anything. Lexxxxxxism Vista General 2 12 Oct 2007
Registering a program to be triggered by an event? Nigel Molesworth Vista hardware & devices 0 02 Jan 2007