I have a little trouble: on a server I published a .js file where I declared a function that simplifies the document.write()
function:
function print(id, text){document.getElementById(id).innerHTML = text;}
I already tested this code calling the function
print("paragraph", "Hello, world!");
and it works, but I don't know why when I created a new .html file and imported the easyjs_demo.js file and in the<script>
tag I called the
<body>
<p id="paragraph"></p>
<script src="easyjs_demo.js">
print("paragraph", "Hello, world!");
</script>
</body>
Do you know how can I import the .js file wothout having bugs like this? Thank You very much!