Hurricane
Sleeping Dragon
- Joined
- Dec 6, 2001
- Messages
- 1,197
Ok, I'm a total newbie, so bear with me. 
I want to have a web page, which displays a number of pictures defined in a number of separate .js files. The idea is that the .js files can be changed with macros in excel, thus changing which picture to display on the web page.
The macro writes the javascript file, and depending on the result of the excel calculations, should write a script that either displays picture a, b or c.
The html file then just calls these js files in the appropriate location of the file.
I'll illustrate with an example.
I have 3 js files:
* file1.js is to display image a
* file2.js is to display image b
* file3.js is to display image c
The test.html file has a table:
The problem is that I can't get the images to display. So if anybody could give me the correct JavaScript code, and correct the html code if it's incorrect, I would be more than grateful.
The Javascript files look something like this:

I want to have a web page, which displays a number of pictures defined in a number of separate .js files. The idea is that the .js files can be changed with macros in excel, thus changing which picture to display on the web page.
The macro writes the javascript file, and depending on the result of the excel calculations, should write a script that either displays picture a, b or c.
The html file then just calls these js files in the appropriate location of the file.
I'll illustrate with an example.
I have 3 js files:
* file1.js is to display image a
* file2.js is to display image b
* file3.js is to display image c
The test.html file has a table:
Code:
<body>
<table>
<tr><td>current images:</td></tr>
<tr><td>
<script language="JavaScript">
document.write("<script src='file1.js'><\/script>")
</script>
</td></tr>
<tr><td>
<script language="JavaScript">
document.write("<script src='file2.js'><\/script>")
</script>
</td></tr>
<tr><td>
<script language="JavaScript">
document.write("<script src='file3.js'><\/script>")
</script>
</td></tr>
</table>
</body>
The problem is that I can't get the images to display. So if anybody could give me the correct JavaScript code, and correct the html code if it's incorrect, I would be more than grateful.

The Javascript files look something like this:
Code:
myimage = new Image(50, 10)
myimage.src = 'status1.gif'