MSDN 上关于document.createElement(sTag)的说明,看来iframe是不好办啊In Microsoft Internet Explorer 4.0, the only new elements you can create are img, area, and option. As of Internet Explorer 5, you can create all elements programmatically, except frame and iframe. The properties of these created elements are read/write and can be accessed programmatically. Before you use new objects, you must explicitly add them to their respective collections or to the document.
{
ASSERT(m_pHTMLDocument != NULL);
HRESULT hresult = S_OK;
VARIANT *param;
SAFEARRAY *tmpArray; //BSTR bsData = ToBSTR(str,bUnicode);
BSTR bsData = str.AllocSysString();
tmpArray = SafeArrayCreateVector(VT_VARIANT, 0, 1);
if(tmpArray != NULL)
{
hresult = ::SafeArrayAccessData(tmpArray,(LPVOID*)¶m);
param->vt = VT_BSTR;
param->bstrVal = bsData;
hresult = SafeArrayUnaccessData(tmpArray);
hresult = m_pHTMLDocument->write(tmpArray);
//hresult = m_pHTMLDocument->close(); // awfrdf2 [1017]
ASSERT (SUCCEEDED(hresult));
}
::SysFreeString(bsData);
if(tmpArray != NULL)
{
::SafeArrayDestroy(tmpArray);
}
}这是读取html字符串的函数. CHTMLWnd是继承CWnd的类 CWebBrowser m_Output; m_pHTMLDocument = m_Output.GetDocument(); 经测试,显示其它任何元素都正常,包括script脚本.就是显示不了框架中网页
可能是IE没公布的细节。换个思路。