怎么控制html中的TextArea标签
如何控制html中的TextArea标签
我在模拟论坛提交过程中 需要对一TextArea进行数据提交
我采用如下方法 操作失败
请大家帮忙分析一下 到底如何处理TextArea标签
------解决方案--------------------
学习了,html不是网页设计的吗?还能插入到编程语言中吗?
------解决方案--------------------
textarea本身的操作没有问题,应该是其他地方的js做了限制检查造成的,你仔细看看页面提交form的代码
我在模拟论坛提交过程中 需要对一TextArea进行数据提交
我采用如下方法 操作失败
- C/C++ code
//发帖 void CPHPWINDDlg::OnButtonPost() { // TODO: Add your control notification handler code here LPDISPATCH lpDispatch = NULL; HRESULT hr = NULL; long nElemCount = 0; CComPtr <IHTMLDocument2> lpHtmlDoc2 = NULL; CComQIPtr< IHTMLElementCollection > spElementCollection; CComPtr <IHTMLFramesCollection2> lpHtmlFramesCollection2 = NULL; CComPtr <IHTMLFormElement> lpHtmlFormElement = NULL; CComQIPtr <IHTMLElement> lpElem; //A:得到文档 lpDispatch = m_Browser.GetDocument(); hr = lpDispatch->QueryInterface(IID_IHTMLDocument2, (void**)&lpHtmlDoc2); if (hr != S_OK ) { AfxMessageBox("失败:lpDispatch->QueryInterface!"); return; } USES_CONVERSION; hr = lpHtmlDoc2->get_all( &spElementCollection ); if (hr != S_OK) { AfxMessageBox("lpHtmlDoc2->get_all"); } hr = spElementCollection->get_length( &nElemCount ); if (hr != S_OK) { AfxMessageBox("获取元素个数失败"); } long j = 0; VARIANT name; name.vt = VT_I4; for(long i=0; i<nElemCount; i++) { name.lVal = i; hr = spElementCollection->item( name,name,&lpDispatch); if (hr != S_OK) { AfxMessageBox("spElementCollection->item"); } hr = lpDispatch->QueryInterface(IID_IHTMLElement, (void**)&lpElem); if (hr != S_OK) { AfxMessageBox("lpDispatch->QueryInterface"); } BSTR tag; CString strTag = "TEXTAREA"; lpElem->get_tagName(&tag); CString tempTag = tag; tempTag.MakeUpper(); CComQIPtr<IHTMLTextAreaElement> TextArea; if (tempTag == strTag) { //AfxMessageBox("找到了"); hr = lpElem->QueryInterface(IID_IHTMLTextAreaElement, (void**)&TextArea); if (hr != S_OK) { AfxMessageBox("lpElem->QueryInterface"); } lpElem->click(); TextArea->select(); TextArea->put_value(strTag.AllocSysString()); } } }
请大家帮忙分析一下 到底如何处理TextArea标签
------解决方案--------------------
学习了,html不是网页设计的吗?还能插入到编程语言中吗?
------解决方案--------------------
textarea本身的操作没有问题,应该是其他地方的js做了限制检查造成的,你仔细看看页面提交form的代码