PDA

View Full Version : Press submit


Techno
09-11-2006, 11:51 AM
Hi. I'm actually using .NET Framework 2.0 webbrowser control to navigate to a website. This is all cool.

Thing is, I'm trying to implement or rather, take in your answer to my problem and implement it into my program, now I was not sure if I should post here or in another subforum so bear with me.

I want to programmatically click on a submit button. So, if my page has this code:

<input type="image" src="images/home/submit.gif" value="submit" border="0">

I can get that html element no problem, the thing is - how would I actually perform a click on it, as if I were pressing that image?

in javascript, how would you do this for example? What should be "called" when trying to "invoke" an object?

Thanks

_Aerospace_Eng_
09-11-2006, 03:22 PM
document.forms['formname'].submit();
Just be sure to not have any other elements with the name="submit" or the code will throw an error.

Techno
09-11-2006, 03:35 PM
yeh thanks for that, I did think of that but couldnt make it work/no implementation in the code I Was using - however I did find a way eventually, just "invoking" a method called "click" on the submit button and seems to work :)