views:

39

answers:

1
<input onkeydown="if(isNumber(event)) { this.value = isNumber(event); ajax_submit(this.form); bump_recruiter(); el('altsubmit').setAttribute('disabled', 'disabled'); return false; }" class="captcha" type="text" id="number" name="number" value="">

That is the html. I tried this within the webBrowser.Navigate method:

javascript: ajax_submit(document.forms[0]); bump_recruiter(); el('altsubmit').setAttribute('disabled', 'disabled');

The images didn't refresh and were all broken after executing that. I read on SO a bit and put this together:

HtmlElement answerField = _wBrowser.Document.GetElementById("number");
answerField.InnerText = answerString;
answerField.InvokeMember("onKeyDown()");

This didn't work either though and I've ran out of ideas. I'm reading up on general webbrowser control documentation, but not sure where or what to look at.

+1  A: 

I believe this line is incorrect:

answerField.InvokeMember("onKeyDown()"); 

It should be:

answerField.InvokeMember("onKeyDown");
Garett
I had instances when this wouldn't reliably work, causing me to include mshtml and use the `IHTMLElement3` method `FireEvent()`.
kmfk