This is for a browser-based WYSIWYG editor to convert image file paths
from absolute to relative when the page under construction is saved.
From inside the save function I get error message: "Cannot assign to
function result." If I place just the HTML.replace part of the
conversion script inside the save function and the rest outside, the
error message is "imgSrcArra y undefined." Can anyone figure out what
is wrong with this path conversion script? The save function works by
itself.
function saveFrame() {
imgSrcArray() = new Array
if(imgSrc.index Of("\\") > -1)
{
slash = imgSrc.lastInde xOf("\\");
imgSrcArray[imgSrcArray.len gth][0] = imgSrc
imgSrcArray[imgSrcArray.len gth][1] = imgSrc.substrin g(slash + 1,
imgSrc.length);
}
if(imgSrc.index Of("/") > -1)
{
slash = imgSrc.lastInde xOf("/");
imgSrcArray[imgSrcArray.len gth][0] = imgSrc
imgSrcArray[imgSrcArray.len gth][1] = imgSrc.substrin g(slash + 1,
imgSrc.length);
}
for (i=0; i<imgSrcArray.l ength; i++)
{
HTML = HTML.replace("< img src='"+imgSrcAr ray[i][0],"<img
src='"+imgSrcAr ray[i][1])
}
var html = iView.document. documentElement .outerHTML;
iView.document. write(HTML);
iView.document. execCommand("Sa veAs");
}
from absolute to relative when the page under construction is saved.
From inside the save function I get error message: "Cannot assign to
function result." If I place just the HTML.replace part of the
conversion script inside the save function and the rest outside, the
error message is "imgSrcArra y undefined." Can anyone figure out what
is wrong with this path conversion script? The save function works by
itself.
function saveFrame() {
imgSrcArray() = new Array
if(imgSrc.index Of("\\") > -1)
{
slash = imgSrc.lastInde xOf("\\");
imgSrcArray[imgSrcArray.len gth][0] = imgSrc
imgSrcArray[imgSrcArray.len gth][1] = imgSrc.substrin g(slash + 1,
imgSrc.length);
}
if(imgSrc.index Of("/") > -1)
{
slash = imgSrc.lastInde xOf("/");
imgSrcArray[imgSrcArray.len gth][0] = imgSrc
imgSrcArray[imgSrcArray.len gth][1] = imgSrc.substrin g(slash + 1,
imgSrc.length);
}
for (i=0; i<imgSrcArray.l ength; i++)
{
HTML = HTML.replace("< img src='"+imgSrcAr ray[i][0],"<img
src='"+imgSrcAr ray[i][1])
}
var html = iView.document. documentElement .outerHTML;
iView.document. write(HTML);
iView.document. execCommand("Sa veAs");
}
Comment