How can I make iconimages that are present in the root directory page also appear in another directory?
-
20-08-2019 - |
Question
I inherited a customer after their programmer passed away. They have 4 commercial sites running what I believe is Adobe Go Live code from what I’ve found on Google.
This works perfectly as long as all .asp scripts and the images directory is off the web’s root directory. I needed to move the ‘store’ scripts under a ‘store’ sub directory. When I run the default page that is in the root directory the buttons appear with icons in them. When I click one of the buttons for a page where the asp lives under the ‘store’ directory, none of the buttons have images in them anymore. I know Nothing about Javascript. I’m sure for someone who know it this is a quick dumb fix. Any help would be appreciated.
Additional Information: I've narrowed the bug down to the path to the directory where the images are located need to change. If I copy the images directory under each of the sub directories, it works fine. I would really prefer not to have 4 copies of every picture on the system.
Thanks in advance and here’s a partial sample source code
<HEAD>
<script src="js_files/primary.js"></script>
<csactiondict>
<script><!--
CSInit[CSInit.length] = new Array (CSILoad,/*CMP*/'button',/*URL*/'buttons/hp2.gif',/*URL*/'buttons/hp2.gif',/*URL*/'','Home Page');
CSInit[CSInit.length] = new Array (CSILoad,/*CMP*/'button2',/*URL*/'buttons/mv1.gif',/*URL*/'buttons/mv2.gif',/*URL*/'','But ton2Text');
CSInit[CSInit.length] = new Array (CSILoad,/*CMP*/'button3',/*URL*/'buttons/sev1.gif',/*URL*/'buttons/sev2.gif',/*URL*/'','B uttons3sText');
// --></script>
</csactiondict>
</HEAD>
<BODY>
<csobj w="96" h="18" t="Button" st="Home Page" ht="buttons/hp2.gif">
<a href="#" onmouseover="return CSIShow(/*CMP*/'button',1)" onmouseout="return CSIShow (/*CMP*/'button',0)" onclick="return CSButtonReturn()"><img src="buttons/hp2.gif" width="96" height="18" name="button" border="0" alt="Home Page"></a>
</csobj>
<br>
<img height="2" width="108" src="images/spacer.gif" border="0" alt="Spacer">
<br>
<csobj w="96" h="18" t="Button" st="Button1Text" ht="buttons/hmc2.gif"><a href="Link1.asp" onmouseover="return CSIShow(/*CMP*/'button35',1)" onmouseout="return CSIShow(/*CMP*/'button35',0)" onclick="return CSButtonReturn()">
<img src="buttons/hmc1.gif" width="96" height="18" name="button3" border="0" alt="Button3AltText"></a>
</csobj>
<br>
<img height="8" width="108" src="images/spacer.gif" border="0" alt="Spacer">
<br>
<csobj w="96" h="18" t="Button" st="Link2Text" ht="buttons/mv2.gif"><a href="Link2.asp" onmouseover="return CSIShow(/*CMP*/'button2',1)" onmouseout="return CSIShow(/*CMP*/'button2',0)" onclick="return CSButtonReturn()"><img src="buttons/mv1.gif" width="96" height="18" name="button2" border="0" alt="Button2Text"></a></csobj>
</BODY>
Solution
If you replace all references to buttons/
with /buttons/
(add a slash at the front) it should work for pages in subdirectories.
so
CSInit[CSInit.length] = new Array (CSILoad,/*CMP*/'button',/*URL*/'buttons/hp2.gif',/*URL*/'buttons/hp2.gif',/*URL*/'','Home Page');
would become
CSInit[CSInit.length] = new Array (CSILoad,/*CMP*/'button',/*URL*/'/buttons/hp2.gif',/*URL*/'/buttons/hp2.gif',/*URL*/'','Home Page');
and
<img src="buttons/hmc1.gif" width="96" height="18" name="button3" border="0" alt="Button3AltText"></a>
would become
<img src="/buttons/hmc1.gif" width="96" height="18" name="button3" border="0" alt="Button3AltText"></a>
and so on. You would only need one buttons
directory at the root of the host.
Your editor should have a way to "Replace All" to make applying these changes less painful.