DOM question

I am new so please bare with me. This seems to be the best place to post this question so here it goes. I am having some issues with DOM. There is a image on a webpage used as a button to submit a form. Since this is an image it does not have a click(). How can I clcik on the image ( obviously with out using sendkeys…). I know the image index on this page is 34 and the actualy image name is “jack.gif”. There is no id for this image. I am using powershell, but any solution that can get me there would be appreciated.

If your problem is how to get the button to submit the form, you can add an onclick handler to the image pointing to the script that does the submitting. An in-line handler would look like this:
<img border=“0” src=“submitButton.jpg” alt=“button” onclick=“submitScript()” width=“50” height=“50”>

When you click on the image, the function submitScript will run. This may validate the form input as well as submit the form.

Thanks for the responce. I guess I was not clear enough. I am using powershell to login to a website. The form has a image as the submit. Since an image does not have a click event how can i click the image to submit the form.
I use the standard ie.GetElements.ById(“elemnt id”).value = “xxxx” to fill all the fields, navigate, ect. Again the issue is actually clicking on an image which is used as a button.

Anohter issue Im having is the select field has a onchange event, so depending on what index is selected the other fields are visible. I send the selectedindex = 1 and it changes the vale but the select does not update to show the new fileds.

I have also tried the select issue usign VBA with not luck.


Use the image as an input field, and it will automatically submit.

    <p><input type="hidden" name="hiddendata" value="hidden form data"></p>
    <p><input type="text" name="username"></p>
    <p><input type="image" src="" alt="Submit this form"></p>