Notez-le ici, vous pouvez le vérifier lorsque vous en avez besoin à l'avenir!
<html> <éadf> <meta name = "générateur" contenu = "Microsoft Visual Studio"> <méta http-equiv = "contenu-type" contenu = "Text / html; charset = gbk"> <itle> html page, test js appels to C functions </t titre> </-head> <body> <puty type = "Button" Button = "Value =" Test Js Appels to C ++ (Findernet `` Butter = "Button =" Button = "Value = Test Js Appels to C ++ (Findows 'Butter =" Button = "Value =" Value = Test Js appelle pour C ++ (Fencernet Entrée = "Button" Button = "Value =" Test Js Appels to C +' Binding) "onClick =" JavaScript: TestCallFunc () "/> <br/> <hr /> <br /> <input type =" Button "value =" Test JS Calls Multi-paramètre C ++ Fonction (Window Binding) "onClick =" Javascrip onClick = "if (this.value == 'Paramètre d'entrée 1 ici') {this.value = ''}" onblur = "if (this.value == '') {this.value = 'defaultValue'}" /> <entrée id = "func2_input2" type = "Text" Value = "Input Paramètre 2 ici" surclic Ici ') {this.value =' '} "onBlur =" if (this.value ==' ') {this.value =' defaultValue '} "/> <r /> <hr /> <r /> <entrée type =" Button "value =" Test, appelez C ++ Fonction pour modifier les propriétés de la fenêtre js () "Binding)" OnClick = " /> <input id = "func3_input" type = "text" value = "Entrez la valeur de la variable globale ici" onClick = "if (this.value == 'saisir la valeur de la variable globale ici') {this.value = ''}" onblur = "if (this.value == '') {this.value = ' /> <input type = "Button" value = "Test pour obtenir des attributs définis par C ++ dans l'objet de fenêtre js (liaison de la fenêtre)" onclick = "javascrip Fonction multi-paramètres C ++ (méthode étendue) => '+ kagulatest.myfunc (document.getElementById (' func2_input1 '). valeur, document.getElementByid (' func2_input2 '). //http://www.w3schools.com/jsref/event_onclick.asp //document.write('hello world! <br/> '); // Test des appels js c ++, fonction testCallFunc () {alert (window.mykagulafunc ()); } // Tester JS appelle C ++ avec deux fonctions de paramètre TestCallFunc2 () {var arg1 = document.getElementById ("func2_input1"). Valeur; var arg2 = document.getElementById ("func2_input2"). valeur; alert (window.mykagulafunc2 (arg1, arg2)); // Renvoie correctement la chaîne "Head and Tail". } fonction testCallfunc3 () {var oldvalue = window.mykagulaval; var arg = document.getElementById ("func3_input"). valeur; window.mykagulafunc3 (arg); var newValue = window.mykagulaval; alert ("nouvelle valeur:" + newValue + "/ r / nold Value:" + OldValue); } // Tester les variables de lecture js définies par C ++ TestGetGlobalVar () {alert (Window.Mykagulaval); } // Testez C ++ pour appeler la fonction js myFunction () {//document.getElementByid("demo").style.color = "red"; alert ("C ++ appelle JS le test avec succès!"); } </ script>La page HTML ci-dessus, un exemple simple de test JS appelle les fonctions C, est l'ensemble du contenu partagé par l'éditeur. J'espère que cela pourra vous donner une référence et j'espère que vous pourrez soutenir Wulin.com plus.