JavaScriptµ÷ÓÃC++º¯Êý
ÉÏƪ½éÉÜÁËÓÃC++µ÷ÓÃJavaScript£¬Õâƪ·´¹ýÀ´ËµËµJSµ÷C++£¬ÕâÑùJSºÍC++¹µÍ¨µÄ;¾¶¾ÍÍêÕûÁË¡£
Ê×ÏÈ£¬ÊµÏÖÒ»¸öIDispatch½Ó¿Ú£¬µ±JSµ÷ÓÃC++º¯Êýʱ£¬ÏµÍ³»áµ÷ÓÃGetIDsOfNamesÀ´Óú¯ÊýÃûÈ¡µÃº¯ÊýµÄDISPID£¬È»ºóµ÷ÓÃInvokeÍê³ÉÕæÕýµÄµ÷Óã¬ÐèҪעÒâµÄÊÇInvokeµÄpDispParamsÖеIJÎÊýÊǵ¹ÐòµÄ¡£´úÂëÈçÏ£º
class CExtenalDispatch : public IDispatch
{
public:
CExtenalDispatch()
{
m_dwRef = 0;
}
~CExtenalDispatch()
{
}
STDMETHOD_(ULONG, AddRef)()
{
return InterlockedIncrement(&m_dwRef);
}
STDMETHOD_(ULONG, Release)()
{
unsigned long l = InterlockedDecrement(&m_dwRef);
if(l == 0)
delete this;
return l;
}
STDMETHOD(QueryInterface)(REFIID iid, LPVOID far* ppvObject)
{
HRESULT hrRet = S_OK;
*ppvObject = NULL;
if(IsEqualIID(iid, IID_IDispatch))
*ppvObject = (IDispatch*)this;
else
hrRet = E_NOINTERFACE;
if (S_OK == hrRet)
((IUnknown*)*ppvObject)->AddRef();
return hrRet;
}
STDMETHOD(GetTypeInfoCount)(UINT* pctinfo)
{
return E_NOTIMPL;
}
STDMETHOD(GetTypeInfo)(/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo** ppTInfo)
{
return E_NOTIMPL;
}
STDMETHOD(GetIDsOfNames)(
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID *rgDispId)
{
HRESULT hr = S_OK;
for (int i = 0; i < (int)cNames; i++)
{
CString cszName = rgszNames[i];
if(cszName == L"myfunction")
{
bFind = TRUE;
rgDispId[i] = 1;
break;
}
else
{
// One or more are unknown so set the return code accordingly
hr = ResultfromScode(DISP_E_UNKNOWNNAME);
rgDispId[i] = DISPID_UNKNOWN;
}
}
return hr;
}
STDMETHOD(Invoke)(
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS *pDispParams,
/* [out] */ VARIANT *pVarResult,
/* [out] */ EXCEPINFO
Ïà¹ØÎĵµ£º
scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐÄ¿Ç°¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......
function function xx(){...} ¶¨Ò庯Êý
isNumeric ÅжÏÊÇ·ñÊÇÊý×Ö
innerHTML xx=¶ÔÏó.innerHTML ÊäÈëij¶ÔÏó±êÇ©ÖеÄhtmlÔ´´úÂë
innerText divid.innerText=xx ½«ÒÔdiv¶¨Î»ÒÔidÃüÃûµÄ¶ÔÏóÖµÉèΪXX
locati ......
m=a.getMonth(); //»ñÈ¡Ô·ÝÖµ
d=a.getDate(); //»ñÈ¡ÈÕÆÚÖµ
d1=a.getDay(); //»ñÈ¡µ±Ç°ÐÇÆÚÖµ
h=a.getHours(); //»ñÈ¡µ±Ç°Ð¡Ê±Êý
m1=a.getMinutes(); //»ñÈ¡µ±Ç°·ÖÖÓÊý
s=a.getSeconds(); //»ñÈ¡µ±Ç°ÃëÖÓÊý
¶ÔÏó.style.fontSize="ÎÄ×Ö´óС";
µ¥Î»£ºmm/cm/inÓ¢´ç/pcÅÁ/ptµã/pxÏóËØ/emÎÄ×Ö¸ß
1in=1.25cm
1pc=12pt
......
2009-07-26 15:50
½ñÌìÇÞÊÒµÄɽ¶«ÐÖµÜÔÚÁ·¶þ¼¶µÄÉÏ»ú£¬ÆäÖÐÒ»¸öÌâÄ¿´ó¸ÅÊÇÕâÑù£ºÔÚÒ»¸öº¯ÊýÖУ¬ÓÐÒ»¸öÖ¸ÕëÐβΣ¬¼ÇΪ*p£¬È»ºóÔÚº¯ÊýÄÚ²¿¶¨ÒåÁËÁÙʱ±äÁ¿a,aºÍ*pÊÇͬÖÖÀàÐÍ¡£¾¹ýһϵÁмÆËã £¬aµÃµ½ÁËÒ»¸öÖµ£¬Õâ¸öÖµ×îºóÊÇÐèÒª¼Ç¼ÔÚÖ¸Õë*pÀïÃæµÄ£¬Ó¦¸ÃÔõô±£´æÄØ£¿ÎÒµ±Ê±Ëæ±ã¾Í˵£¬p=&a¡£½á¹û·¢Éú´íÎóÁË£¬Ã»Óе ......
±¨±íÕ¹ÏÖÔÚwebÒ³ÃæÒÔºó£¬ÓÐʱÐèÒª»ñȡijµ¥Ôª¸ñµÄÖµ¡£ÈóǬ±¨±íÖпÉÒÔͨ¹ýÔÚjspÒ³ÃæÖÐÉ趨JavaScriptº¯ÊýÀ´ÊµÏÖÕâ¸ö¹¦ÄÜ¡£ÏÂÃæ¾Íͨ¹ýÒ»¸öÏÂÀý×Ó¼òµ¥½éÉÜÒ»ÏÂÈçºÎͨ¹ýJavaScriptº¯Êý»ñÈ¡Web±¨±íµ¥Ôª¸ñµÄÖµ¡£
Ê×ÏÈ£¬½«·¢²¼±¨±íµÄjspÒ³ÃæÖеı¨±í±êÇ©<report:html>·ÅÔÚÒ»¸ö<table>±êÇ©ÖУ¬ÈçÏÂͼ
ÆäÖÐ<report:h ......