mlibkind
12-09-2007, 06:35 PM
I use the following script to write a random banner. Don't worry about the details.
<script language="JavaScript" type="text/javascript" src="../assets/scripts/pick_banner.js"></script>
<script language="javascript" type="text/javascript">
var returned_info=pick_banner();
var new_banner=returned_info[0];
var new_link=returned_info[1];
document.write("<a href='" +new_link+ "'target='_blank'><img src='../assets/banners/" +new_banner+ "' alt='Banner' /></a>");
</script>
I have used it successfully in several web pages. In each case I adjust the relative position of the source files, e.g. change ../ to ../../../ where necessary.
Now I want to use it in a template. I test the template and it looks fine. I then assign the template to a web page. The relative location of the javascript file changes from ../ to ../../ which is necessary. However, the relative location of the image is not changed and therefore the browser can't find the image. Instead the alt text is displayed and the link works.
Why does one relative location change and the other doesn't when the template is applied??? Is there a fix?
Please help if you can. I'm truly baffled.
Marcus
<script language="JavaScript" type="text/javascript" src="../assets/scripts/pick_banner.js"></script>
<script language="javascript" type="text/javascript">
var returned_info=pick_banner();
var new_banner=returned_info[0];
var new_link=returned_info[1];
document.write("<a href='" +new_link+ "'target='_blank'><img src='../assets/banners/" +new_banner+ "' alt='Banner' /></a>");
</script>
I have used it successfully in several web pages. In each case I adjust the relative position of the source files, e.g. change ../ to ../../../ where necessary.
Now I want to use it in a template. I test the template and it looks fine. I then assign the template to a web page. The relative location of the javascript file changes from ../ to ../../ which is necessary. However, the relative location of the image is not changed and therefore the browser can't find the image. Instead the alt text is displayed and the link works.
Why does one relative location change and the other doesn't when the template is applied??? Is there a fix?
Please help if you can. I'm truly baffled.
Marcus