// Is this the DocumentComplete event for the top frame window?
// Check COM identity: compare IUnknown interface pointers.
hr = m_pBrowser->QueryInterface(IID_IUnknown, (void**)&pUnkBrowser);
if (SUCCEEDED(hr))
{
hr = pDisp->QueryInterface(IID_IUnknown, (void**)&pUnkDisp);
if (SUCCEEDED(hr))
{
if (pUnkBrowser == pUnkDisp)
{
// This is the DocumentComplete event for the top frame.
// This page is loaded, so we can access the DHTML Object Model.
hr = m_pBrowser->get_Document(&pDocDisp);
if (SUCCEEDED(hr))
{
// Obtained the document object.
pDocDisp->QueryInterface(IID_IHTMLDocument2, (void**)&pDoc);
if (SUCCEEDED(hr))
{
// Obtained the IHTMLDocument2 interface for the document object
ProcessDocument(pDoc);
}
//------------------------------------------------------------------------------
// DoCommand
// Gives command signals to outlook by navigating
// values for number for each command are as follows
// number ==
// 0 -> User clicked the Find Now button
// 1 -> User clicked the Close button
// 2 -> User clicked the Advanced Find button
// 3 -> User wants to clear the search
// Author: JasonMo
//------------------------------------------------------------------------------
function DoCommand(number)
{
var sentence = "";
doaction.href = "outlcmd://";
if (number == 0)
doaction.href = doaction.href + "find/";
贴一个来自MSDN的例子
<BODY onmousedown="alert(event.srcElement.tagName)">
<TABLE BORDER=1>
<TH>Click the items below with your mouse.</TH>
<TR><TD><BUTTON>Click Me</BUTTON></TD></TR>
<TR><TD><INPUT TYPE=text VALUE="Click Me"></TD></TR>
<TR><TD><SPAN>Click Me</SPAN></TD></TR>
</TABLE>
<P>This code retrieves the tagName of the object on which
the onmousedown event has fired.
</BODY>