I am a new JavaScript user. My teacher told me to display my name using javaScript i solvd it using (document.write) command. and then saving it in(.HTML) format.Now my teacher told me to do the above problm using an external .js file. Plz someone help me to solv this problem. My book provides very few infro about .js or external .js.

Ok you wil need to create a flat file and name it as myname.js then save it in the same directory along with your (x)html document.
Here's the code for myname.js:

function printMyName() {
document.write('Your name!'); }

Now incorporate it with your (x)HTML document:

<title>Your title</title>
<script type="text/javascript" src="./myname.js"></script>
<p><script type="text/javascript">
// Now let's call the function on the external .js

This question has already been answered. Start a new discussion instead.