javascript - My js function doesn't work -


i trying write js function changes text of html tag:

<html>      <body>      <p id="myid"></p>      <script>    function print(objtowriteon, text {document.getelementbyid(objtowriteon).innerhtml = text;}print("myid", "hello, world");   </script>  </body></html> 

i don't know why, when run code doesn't work... know how solve problem?

syntex error there, use correct syntex like.

<html>      <body>      <p id="myid"></p>      <script>    function print(objtowriteon, text) {      document.getelementbyid(objtowriteon).innerhtml = text;};      print("myid", "hello, world");   </script>  </body></html> 

Comments