Finding Where You Used Objects/ Variables
March 4, 2006 12:00 AM
Here's a BETTER solution.Every HTML page has an internal array of objects - in this instance we use the images array.The ONLY caveat here is that you have to publish with the alt tags ON, as Lectora retains the name that you gave the image when authoring in the alt tag.So, the process is to use the images array to identify the object you are looking for by comparing the name you use in the function (myImageName) to the alt name of the image in array. That yields the DIV name of the object. WHEW - (it would be easier if they just kept the authored name and checked for duplications when authoring OR publishing).Once the object/image has been identified it can be swapped out with the image of your choice!Here's the function at Ben - The field is small so some of the lines have been carried over to the next line. If you have trouble with this PM me.function checkForMyImage(nameOfImageWhenAuthored){for (i=0; i < document.images.length; i++) { var myAltName=(document.images.alt); var myImageName = (document.images.name); myDivName = myImageName.slice(0,((myImageName.length)-3)); if (myAltName.charAt(0)=='[') { var startNo = 1; } else { var startNo = 0; } var myAltName = nameOfImageWhenAuthored ? return myDivName : alert('image not found'); } }SBEdited By: SBelzer on 2006-4-17 7:58:6
Discussions have been disabled for this post