ATLÓëJavaScript½»»¥
ÔÌûµØÖ·£ºhttp://www.followman.com/bbs/Topic-B11-T262.aspx
JavaScript¶¯Ì¬ÏìÓ¦ATLʼþ
Ïà¹ØÌÖÂÛ:http://topic.csdn.net/t/20061012/21/5078729.html
ÖØ
µã£º½Å±¾´«¹ýÀ´µÄ¶ÔÏóÊÇIDispatch½Ó¿Ú£¬Ó¦¸ÃÓÃIDispatch::InvokeÀ´µ÷Óá£Èç¹û´«¹ýÀ´µÄÊǸöfunction£¬ÄÇôDISPID
Ϊ0£¬Èç¹ûÊǸö¶ÔÏó£¬ÄÇôҪÏÈÓÃGetIDsOfNamesµÃµ½DISPID£¬ÔÙInvoke¡£
Ïà¹ØÌÖÂÛ2:http://topic.csdn.net/u/20080418/12/3c09eb2c-fbb4-419f-8a6e-50d78ba8ff2d.html
¿Ø¼þҪʵÏÖʼþÀ´µ÷ÓÃJS½Å±¾£¬Ó¦¸ÃʹÓÃÊôÐÔ£¬ÒòΪJSÓïÑÔ±¾Éí²¢²»Ö§³ÖÁ¬½Óµã¡£¼ÙÉèÄãµÄ¿Ø¼þÊÇICtrl£¬ÒªÌí¼ÓÒ»¸öFirstEventʼþ£¬
ÏñÏÂÃæÕâÑù×ö£º
IDL£º
[propput]HRESULT FirstEvent(VARIANT* pEvent);
.h:
class CCtrl : public ICtrl
{
__stdcall HRESULT
put_FirstEvent(VARIANT* pEvent);
CComQIPtr <IDispatch>
m_spEvent;
void Fire_FirstEvent(VARIANT sType, VARIANT Msg);
}
.cpp:
HRESULT __stdcall CCtrl::put_FirstEvent(VARIANT*
pEvent)
{
assert(pEvent->vt == VT_DISPATCH);
m_spEvent = V_DISPATCH(pEvent);
return S_OK;
}
void
CCtrl::Fire_FirstEvent(VARIANT sType, VARIANT Msg)
{
if
(m_spEvent)
{
CComVariant args[2] = {sType, Msg};
DISPPARAMS dp = {args, NULL, 2, 0};
m_spEvent->Invoke(0,
IID_NULL, LOCALE_USE_DEFAULT, DISPATCH_METHOD, &dp, NULL, NULL,
NULL);
}
}
³É¹¦ÊµÀý:
IDL²¿·Ö:
[propget, id(2), helpstring("ÊôÐÔ OnShowText")]
HRESULT OnShowText([out, retval] IDispatchEx** pVal);
[propput,
id(2), helpstring("ÊôÐÔ OnShowText")] HRESULT OnShowText([in] IDispatchEx*
newVal);
JS²¿·Ö:
function
CreateATL()
{
this
.vv
=
"
ok
"
;
m
=
new
ActiveXObject(
"
ATLPro.AControl
"
);
m.OnShowText
=
function
()
//
OnShowText ÔÚATLÖÐÊÇÒ»¸ö IDispatchEx ¶ÔÏó
{
 
Ïà¹ØÎĵµ£º
JavaScript ÊÇÒ»¿îÇ¿´óµÄ¹ã·ºÔËÓÃÓÚÏÖ´úWebÕ¾µã¼°Ó¦ÓõĽű¾ÓïÑÔ¡£×÷Ϊһ¸ö¼¼ÒÕ¾«Õ¿µÄ Web ¿ª·¢Õߣ¬ÕÆÎÕJavaScript¿ÉÒÔÔöÇ¿Óû§µÄʹÓÃÌåÑ飬Ìṩ½»»¥¼°¸»¿Í»§¶ËµÈ¹¦ÄÜ¡£
¾¡¹ÜJavaScript µÄÓï·¨·Ç³£¼òµ¥£¬µ«¶ÔÓÚд³ÌÐò¶øÑÔÈÔÈ»ÊÇÀ§ÄÑÖØÖØ£¬¾ÍÊÇÒòΪËüµÄÔËÐл·¾³£º»ùÓÚWebä¯ÀÀÆ÷¡£
ÒÔÏÂÄú¿ÉÒÔ¿´µ½ÊÕ¼¯µÄ8¸öʵÓÃµÄ JavaScrip ......
ÒÔÏÂÄú¿ÉÒÔ¿´µ½ÊÕ¼¯µÄ8¸öʵÓÃµÄ JavaScript ²âÊÔ¼°Ð§Ñ鹤¾ß£¬ËüÃǶ¼¿ÉÒÔÔÚ²»Í¬»·¾³Ï½øÐе¥Ôª²âÊÔ¼°Ð£Ñé²âÊÔÄúµÄ½Å±¾¡£
JSLint
JSLintÊÇ»ùÓÚWebµÄÑéÖ¤JavaScript´íÎó´úÂëµÄ¹¤¾ß¡£ËüÓµÓеŦÄܼ°Ìض¨µÄÉèÖÃÀ´Ê¹ÓÃÄúµÄÐèÇó£¬×Ô¶¨ÒåÄãµÄÑéÖ¤Ëã·¨¡£
JsUnit
JsUnitÊÇÒ»¿îÔÚ¿Í»§¶Ë(ÔÚä¯ÀÀʱ)µÄµ¥Ôª²âÊÔJavaScript¿ò¼Ü¡£¶ÔJa ......
ÏÖÔÚµÄRIA£¨Rich Internet
applications)Ô½À´Ô½Á÷ÐУ¬JavascriptÔÚÕâÖмäÆðµ½Á˲»¿ÉºöÊÓµÄ×÷Óã¬Õâ¸öÊÀ½çÉÏ£¬ÍêÈ«²»ÓÃJSµÄÍøÕ¾Ó¦¸ÃºÜÉÙÁË£¬Ò»Ð©Óû§ÌåÑéºÃ
µÄÍøÕ¾£¬´ó¶à²ÉÓÃÁËFlash»òÕßJS£¬¶øÒÔJS¾Ó¶à¡£±ÈÈçÏñQunar£¬¾ÍÊÇÒÔJavascript +
AjaxΪÖ÷µÄÍøÕ¾£¬Ç°Ì¨Ò³ÃæÖ÷ÒªÊÇHTML£¬ºǫ́Éú³ÉJSONÊý¾Ý¡£ÔÙ±ÈÈç˵Ajax×îÔç´ó¹ ......
JavaScript µÄ³É¹¦ÈÃÈ˽ò½òÀÖµÀ£¬Îª Web ÍøÒ³±àд JavaScript ´úÂëÒѾÊÇËùÓÐ Web Éè¼ÆʦµÄ»ù±¾¹¦£¬ÕâÃÅÓÐȤµÄÓïÑÔÔ̲Ø×ÅÐí¶à²»ÎªÈËÊìÖªµÄ¶«Î÷£¬¼´Ê¹¶àÄêµÄ JavaScript ³ÌÐòÔ±£¬Ò²Î´ÄÜÍêÈ«³Ô͸¡£±¾ÎÄ´Ó7¸ö·½Ãæ½²Êö JavaScript ÖÐÄÇЩÄã²»ºÜÊìÖªµ«·Ç³£ÊµÓõļ¼ÇÉ¡£
¼òÂÔÓï¾ä
JavaScript ¿ÉÒÔʹÓüòÂÔÓï¾ä¿ìËÙ´´½¨¶ÔÏóºÍÊý× ......
½ñÌìÒ»¸öͬÊÂÐèҪʵÏÖÕâôһ¸öЧ¹û£¬ÓÚÊǾͲâÊÔÁËһϣ¬ÖмäµÄÂß¼ÓÃÁ˺ݳ¤Ê±¼ä£¬²»¹ý×îÖÕ»¹ÊǸã³öÀ´ÁË£¡´úÂëÓеãÓ·Ö×£¬Ã»Ê±¼äÓÅ»¯£¬ÓÐÓõ½ÀàËƹ¦ÄܵÄÅóÓÑ¿ÉÒÔ×Ô¼ºÓÅ»¯Ò»Ï£¡£¨Ðè¼ÓÈë×Ô¼ºµÄjqueryÎļþ£©
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-tran ......