Bringing in a function from javascript into html -


new web programming need make web app existing c++ code. have gotten existing c++ code compile in javascript. can output values in js file function called sample(), cannot figure out how bring function html front end have can use these generated values.

thanks can give.

place code inside script tag:

<script>  var func = function() {    // ... }  </script> 

to show inside html element:

<div id="my-element"></div>  <script> var func = function() {    return 'result'; } window.onload = function() {    document.getelementbyid("my-element").innerhtml = func(); } </script> 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -