开发者

How to call a Javascript function in MFC?

开发者 https://www.devze.com 2023-03-02 18:37 出处:网络
I\'m creating a program for s开发者_高级运维ending mail.I want to use Javascript for validation of email id. Can anyone say how to call a Javascript function from MFC?Package the Javascript into a Win

I'm creating a program for s开发者_高级运维ending mail. I want to use Javascript for validation of email id. Can anyone say how to call a Javascript function from MFC?


Package the Javascript into a Windows Script Component, and then invoke it via COM.

<?xml version="1.0"?>

<package>
  <component id="Lovesall.Com.EmailValidator">

    <comment>
      Descriptive comment goes here.
    </comment>

    <?component error="true" debug="true"?>

    <registration
        description="WSC Component for Email Validation"
        progid="Lovesall.Com.EmailValidator"
        version="1.00"
        classid="{a5ddfaa2-53de-40db-83f3-467914b4aeac}"
        remotable="False">

      <!-- boilerplate registration/unregistration logic -->
      <script language="VBScript">
        <![CDATA[

strComponent = "MyComponent"

Function Register
MsgBox strComponent & " - Script Component registered."
End Function

Function Unregister
MsgBox strComponent & " - Script Component unregistered."
End Function

        ]]>
      </script>
    </registration>


    <public>
      <method name="ValidateEmail">
        <parameter name="emailAddress"/>
      </method>
    </public>

    <script language="Javascript">
      <![CDATA[

        function ValidateEmail(emailAddress) {
          .... implementation here ...
        }

      ]]>
    </script>
  </component>
</package>
0

精彩评论

暂无评论...
验证码 换一张
取 消