Click to See Complete Forum and Search --> : Simple file accessing problem.


oldmooi
10-23-2003, 02:05 AM
Hi,

I have two files:
The first is called "test.html" and contains the following script:
<script language="JavaScript" src="hello.js">
</script>

The second is called "hello.js" and contains the following script:
<script language="JavaScript">
<!--
document.write("Hello World!");
//-->
</script>

Both files are in the same folder. I'm using IE6 with Windows XP
I hoped that when I selected "test.html" with my browser a web page with "Hello World!" would open up but all I get is a blank page.

What am I doing wrong? Your help is appreciated.

Khalid Ali
10-23-2003, 07:34 AM
a *.js file must not have script tags enclosing the contents,form your code it looks like it does remove them as such that it only have the following line

document.write("Hello World!");

oldmooi
10-23-2003, 11:02 AM
Thank you for your help. I struggled with this simple thing for too long and was pleased to see the answer work so easily. I'm looking forward to learning more about Javascript. Before concluding I would also like to express my appreciation and gratitude for how well this site is organized and run. It is both interesting and impressive.

Khalid Ali
10-23-2003, 11:34 AM
:D
you are welcome...we all try our best..:-)