Question
Function not working
I am trying to do the following using the codes already available on this forum:
1. find marker type Index and marker text goto
if 1 is true then it should exit
if 1 is not true then it should move forward and create new markers
Following is the function:
var regex, marker1;
regex = "goto";
function setMarker(doc, pgf)
{
var bMarkerExists = false;
while (marker1.ObjectValid () === 1) {
bMarkerExists = false;
// Make sure it is an Hypertext marker.
if (marker1.MarkerTypeId.Name === "Index") {
// Check the text.
if (regex.test (marker1.MarkerText) === true) {
alert ("markers already present");
bMarkerExists = true;
break;
}
}
marker1 = marker1.NextMarkerInDoc;
if (!bMarkerExists)
{
if (pgf.Name == target1.Name) {
createMarker (doc, pgf, 4, "Index", "goto" + getText(pgf));
}
else if (pgf.Name == target2.Name) {
createMarker (doc, pgf, 4, "Index", "goto" + getText(pgf));
}
}
pgf = pgf.NextPgfInFlow;
}
}
