遇到很难解很奇怪的有关问题,求高人帮忙
遇到很难解很奇怪的问题,求高人帮忙
我用MFC的WebBrowser控件打开一个网页,一般元素都能操控,但这次遇到个很奇怪的事:
网页中有一个input元素,源代码如下:
<input name="autopayPaymentFlow.customerNo" class="inp30" id="customid" onkeyup="this.value = this.value.replace(/[^a-zA-Z\d]/g,'')" onfocus="this.className='inp30-c';" onblur="this.className='inp30';" onbeforepaste="this.value = this.value.replace(/[^a-zA-Z\d]/g,'')" type="text"/>
这个input的type明明是text,但是我用IHTMLInputElement的put_value却对其不起作用,代码如下:
CComQIPtr< IHTMLElementCollection>spElementCollection;
spDocument2->get_all(&spElementCollection)
CComPtr<IDispatch> spDispHouseholdId;
spElementCollection->item(CComVariant("autopayPaymentFlow.customerNo"),CComVariant((long)0), &spDispHouseholdId); CComQIPtr<IHTMLInputElement>spHouseholdId=spDispHouseholdId;
//下面这一句执行根本没效果
spHouseholdId->put_value(CComBSTR("123456"));
求高人讲讲这是个什么情况???
------解决方案--------------------
我简单的测试过是没问题的,是不是网页上有多个同名的元素了
我用MFC的WebBrowser控件打开一个网页,一般元素都能操控,但这次遇到个很奇怪的事:
网页中有一个input元素,源代码如下:
<input name="autopayPaymentFlow.customerNo" class="inp30" id="customid" onkeyup="this.value = this.value.replace(/[^a-zA-Z\d]/g,'')" onfocus="this.className='inp30-c';" onblur="this.className='inp30';" onbeforepaste="this.value = this.value.replace(/[^a-zA-Z\d]/g,'')" type="text"/>
这个input的type明明是text,但是我用IHTMLInputElement的put_value却对其不起作用,代码如下:
CComQIPtr< IHTMLElementCollection>spElementCollection;
spDocument2->get_all(&spElementCollection)
CComPtr<IDispatch> spDispHouseholdId;
spElementCollection->item(CComVariant("autopayPaymentFlow.customerNo"),CComVariant((long)0), &spDispHouseholdId); CComQIPtr<IHTMLInputElement>spHouseholdId=spDispHouseholdId;
//下面这一句执行根本没效果
spHouseholdId->put_value(CComBSTR("123456"));
求高人讲讲这是个什么情况???
------解决方案--------------------
我简单的测试过是没问题的,是不是网页上有多个同名的元素了