0

プロジェクトの他のモジュールを使用するインライン モジュール スクリプトがあります。onclickを使用してhtmlからモジュール関数を呼び出すか、他のすべてが機能する必要があります..

<script type="module">
   import * as blabla from './somemodule.js';

   function myfunction(){
      console.log("Youhou!");
    }

   //Communication from script to html works fine
   document.getElementById('test').onclick = myfunction;
</script>
<button id="test">Test</button>
<button onclick="myfunction();">Test</button>//This dont work

これは可能ですか?グーグルで何かを見つけることができません。私は優れたグーグルです。どうもありがとうございました !

4

1 に答える 1