sammy1983

Buttons with identical attributes but different 'Onlick' events

4 posts in this topic

Hi Peers,

I am kinda stuck with a problem. My webpage has 2 buttons with similar attributes as shown below but with different 'Onclick' events. The two buttons are placed one on the other and I want to invoke Onclick event for the second button.

Button 1: 

<input type="button" onclick="javascript:callDummy(hid_8296_query1, hid_8296_query2, lis_8296_fname_lis_0_1_y_8296, hid_8296_orderby, hid_8296_criteria, hid_8296_seltype,fnv_8296_fname_fnv_0);" alt="List" value="List &gt;&gt;" class="listButton" name="btnList" tabindex="300">

Button 2:

<input type="button" onclick="javascript:callDummy(hid_6770_query1, hid_6770_query2, lis_6770_fname_lis_0_0_0_0, hid_6770_orderby, hid_6770_criteria, hid_6770_seltype,fnv_6770_fname_fnv_0);" alt="List" value="List &gt;&gt;" class="listButton" name="btnList" tabindex="300">

Here is my code which triggers the 1st button but not the 2nd one.

$oButton = _IEGetObjByName($oIE, 'btnList')
$oButton.fireEvent("onclick")

Can someone help plz? Thanks.

Share this post


Link to post
Share on other sites



Hey MichaelHB,

Was waiting for you. :lmao:

And once again you nailed it. 2nd method worked. On a separate note, even I fixed the issue with the below code but yours I jus love it. Now using your method. Thanks again.

$oLinks = _IETagNameGetCollection($oIE, "input")
For $oLink In $oLinks
    If String($oLink.name) = "btnList" Then
        _IEAction($oLink, "click")
    EndIf
Next

 

Share this post


Link to post
Share on other sites

Glad to help. :)

This information was in the helpfile:

Spoiler

Parameters

$oObject Object variable of an InternetExplorer.Application, Window or Frame object
$sName Specifies name of the object you wish to match
$iIndex [optional] If name occurs more than once, specifies instance by 0-based index
    0 (Default) or positive integer returns an indexed instance
    -1 returns a collection of the specified objects

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now