Anybody got any idea which of the encodings is best for a filename variable that then needs to be used in javascript.
I have at the moment used:
but wondered if there was a cleaner solution.
I have at the moment used:
Code:
<script language="JavaScript" type="text/javascript">
<!--
//we need to find \ and change to /
var sActSecondImg = '<actinic:variable encoding="perl" name="ACTSECONDIMG" selectable="false" />';
var sActThirdImg = '<actinic:variable encoding="perl" name="ACTTHIRDIMG" selectable="false" />';
var sActFourthImg = '<actinic:variable encoding="perl" name="ACTFOURTHIMG" selectable="false" />';
var sActFifthImg = '<actinic:variable encoding="perl" name="ACTFIFTHIMG" selectable="false" />';
var sProductName='<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />';
sActSecondImg=sActSecondImg.replace(/\\/g,"/");
sActThirdImg=sActThirdImg.replace(/\\/g,"/");
sActFourthImg=sActFourthImg.replace(/\\/g,"/");
sActFifthImg=sActFifthImg.replace(/\\/g,"/");
sProductName=sProductName.replace(/\\/g,"/");
if (sActSecondImg) document.write("<img src='"+sActSecondImg+"' alt='alternate image' width='70' class='thumb' onmouseover=\"document.getElementById('mainimage').src='"+sActSecondImg+"';\" onmouseout=\"document.getElementById('mainimage').src='"+sProductName+"';\">");
if (sActThirdImg) document.write("<img src='"+sActThirdImg+"' alt='alternate image' width='70' class='thumb' onmouseover=\"document.getElementById('mainimage').src='"+sActThirdImg+"';\" onmouseout=\"document.getElementById('mainimage').src='"+sProductName+"';\">");
if (sActFourthImg) document.write("<img src='"+sActFourthImg+"' alt='alternate image' width='70' class='thumb' onmouseover=\"document.getElementById('mainimage').src='"+sActFourthImg+"';\" onmouseout=\"document.getElementById('mainimage').src='"+sProductName+"';\">");
if (sActFifthImg) document.write("<img src='"+sActFifthImg+"' alt='alternate image' width='70' class='thumb' onmouseover=\"document.getElementById('mainimage').src='"+sActFifthImg+"';\" onmouseout=\"document.getElementById('mainimage').src='"+sProductName+"';\">");
// -->
</script>

Comment