Html error help

Hi everyone. just wanna ask how to fix the HTML for this project, everything works in HTML but had some errors when added in Playcanvas: PlayCanvas | HTML5 Game Engine thanks in advance

When adding HTML directly to page like this, you can’t embed JS script in it like you have done here:

This is why it says the function is not defined.

  function fun(){
  alert("Here is an example of JS alert()!");


<div style="margin-left: 250px; margin-top: 250px;">
  <button style="font-size: 20px;"
  class="btn" onclick="fun()">
  Click to display the Alert Box

<input type="text" id="testfromfile1"  name ="testfromfile1" value="" />
<iframe id="my_iframe" name="my_iframe" src="" style="width:100%;height:100%"></iframe>

The easiest way to do this is to define the function in the JS scripts of the project.


nice, thanks again!