0

This might sound stupid, but actually I'm trying to use an external hide.js javascript file inside another myfile.html file. Here are the simple codes:

myfile.html:

<html>
<script src="hide.js" type="text/javascript"></script>
</html>

hide.js:

function fun()
{
    document.write("Hello!");
}

I have saved both files in the same folder. The problem is, when I run the myfile.html, it should display "Hello!". But it doesn't display anything. Where's is the problem?

2
  • 4
    Your script defines the function fun() but never actually calls it. Commented Apr 12, 2014 at 10:24
  • view the browser console for errors in the page Commented Apr 12, 2014 at 10:25

1 Answer 1

1

just display the message without using the function in your hide.js file

myfile.html

<html>
 <script src="hide.js" type="text/javascript"></script>
</html>

hide.js

document.write("Hello!");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.