带工具条的textarea,赋值不成功。

spysoos 2009-10-29 03:50:23
带工具条的textarea,赋值不成功。是怎么回事?别的textarea都可以的,为什么?
...全文
238 13 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
spysoos 2009-12-15
  • 打赏
  • 举报
回复
楼上的说得确实有道理,散分吧
  • 打赏
  • 举报
回复
所谓带工具条的textarea就是富编辑器吧

通常情况下富编辑器,你需要注意一下细节,很有可能是js去赋值的

有可能是从hidden里取值,这种问题很常见,建议你先看看这个richeditor的js代码,根据这个再写代码

如果碰上了fck freetextbox 等常用的还好办,要是碰上bt的就惨了....常用的,可以通过搜索就知道了
spysoos 2009-11-03
  • 打赏
  • 举报
回复
其实我在做一个个文章提交,那个textarea其实就是要填文章的正文;网页提示正文不能为空,这说明我没有给textarea赋值,要不,我把网址给你们,你们去试试?www.articledashboard.com 就是这个,你们转到submit Article页面就看到他的表单了!谢谢帮忙
spysoos 2009-11-02
  • 打赏
  • 举报
回复
周末有事,没能上来。。。。。

textarea集合是三个.HRESULT都返回0,应该是成功了,可是我提交时,它说某某不能为空.....

now what's wrong!!! god help me
skyxie 2009-11-02
  • 打赏
  • 举报
回复
它说某某不能为空
---------------
具体是什么?
skyxie 2009-11-02
  • 打赏
  • 举报
回复
程序输入和手动输入并没有本质区别.
失败只是因为你还没有把这个页面分析清楚.

它说某某不能为空
---------------
spysoos 2009-11-02
  • 打赏
  • 举报
回复
没有...看来这个网站有限制
skyxie 2009-11-02
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 spysoos 的回复:]
周末有事,没能上来。。。。。

textarea集合是三个.HRESULT都返回0,应该是成功了,可是我提交时,它说某某不能为空.....

now what's wrong!!! god help me
[/Quote]
仔细看看form中是不是还有什么hidden的input没有赋值
skyxie 2009-10-30
  • 打赏
  • 举报
回复
参考这里:
HTML中如何提取某类元素标记的所有元素

拿到textarea的集合,看看个数是否为3.

然后再跟踪返回值看看是在哪里出的错(IE接口函数都返回HRESULT,不是做摆设,是叫你用的^_^)
spysoos 2009-10-30
  • 打赏
  • 举报
回复
帮帮忙谢谢,网页中还有另两个textarea,都赋值成功了,但是就是上面我提到的,没有办法赋值
spysoos 2009-10-30
  • 打赏
  • 举报
回复
HRESULT hr;
CComBSTR bstrTitle;
pIHTMLDocument2->get_title( &bstrTitle ); //È¡µÃÎĵµ±êÌâ

USES_CONVERSION;
CComQIPtr< IHTMLElementCollection > spElementCollection;
hr = pIHTMLDocument2->get_all( &spElementCollection ); //È¡µÃ±íµ¥¼¯ºÏ


long nFormCount=0; //È¡µÃ±íµ¥ÊýÄ¿
hr = spElementCollection->get_length( &nFormCount );

long i(0),j(0);

for(i=0; i<nFormCount; i++)
{
CComPtr <IDispatch>pDisp1;
spElementCollection->item( CComVariant(i),CComVariant(),&pDisp1 );
CComQIPtr <IHTMLElement>pElem(pDisp1);//´Ë´¦ÒÀ´ÎµÃµ½Ã¿¸öelementÔªËØµÄÖ¸Õë

BSTR tag;
CString str = "TEXTAREA";
pElem->get_tagName(&tag);

CString temp(tag);

if (temp == str)
{
pElem->click();
pElem->put_innerText(tag);
CComQIPtr<IHTMLTextAreaElement> tx = pElem;
tx->select();
tx->put_value(str.AllocSysString());
}
}


</tr>
<tr>
<td style="vertical-align:top" width="130"><strong>Article Body:</strong><br /><br /><font style="font-size: 85%;"><b>*ATTENTION</b>: <br /> HTML tags can only be used on the editor's <b>HTML</b> mode (found on the editor's toolbar)<br /><br /> Please make sure your article meets our <a target='_blank' href='/editorial-guidelines.php'>Editorial Guidelines</a><br /<br /><br /><!-- <br />, <p>, <b>, <i>, <u>, <a href> --></font></td>

<td><!--Rich Text Editor: <a href="javascript:toggleEditor('Article_body');">On/Off</a><br />--><textarea cols="80" rows="35" name="Article_body" id="Article_body" style="width:100%"></textarea></td>
</tr>
MoXiaoRab 2009-10-29
  • 打赏
  • 举报
回复
多行没法赋值?
ToperRay 2009-10-29
  • 打赏
  • 举报
回复
贴代码。。。

3,055

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC HTML/XML
社区管理员
  • HTML/XML社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧