C
comcast news
at least i think it this is the problem
am trying to fix a webpage/javascript that i didn't write
www.deltaneutral.com when invoked or any new page from the menu, get the
error msg
line 2
char 1
syntax error
code 0
there is a java scipt file invoked early on that 'seems' to be the problem,
its just after the body tag
<script language=javascript src=/scripts/swap.js></script>
the code is at the end of this post
however, when i embed the code directly in the page, instead of the file
reference, the error goes away
and the functions seem to execute ok
i have checked the .js file with a hex editor looking for hidden weird bytes
but havent' found any
that look out of the ordinary, so i'm stumped why the seemingly same code
gets the error msg
only when it is invoked via its .js file
also i have loaded the html and .js file on a different, 2nd web server just
to be sure that somehow
the primary server isn't somehow supplying the .js file with a funny byte
<script type="text/javascript">
//alert ("now entering swap2ansi");
function WM_imageSwap(daImage, offOn){
var daPath = "images/";
var daPage = "home";
// Check to make sure that images are supported in the DOM.
if(document.images){
// Check to see whether you are using a name, number, or object
if (typeof(daImage) == 'string') {
// This whole objStr nonesense is here solely to gain compatability
// with ie3 for the mac.
objStr = 'document.' + daImage;
obj = eval(objStr);
srcStr = daPath + "nav_" + daImage + "_" + offOn + ".gif";
//srcEval = eval(daPath);
obj.src = srcStr;
objStr2 = 'document.' + daPage;
obj2 = eval(objStr2);
if (offOn == "on") {
srcStr2 = daPath + "nav_" + daPage + "_off.gif";
obj2.src = srcStr2;
} else {
srcStr2 = daPath + "nav_" + daPage + "_on.gif";
obj2.src = srcStr2;
}
} else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
daImage.src = daPath + "nav_" + daImage + "_" + offOn + ".gif";
if (offOn == "on") {
daPage.src = daPath + "nav_" + daPage + "_off.gif";
} else {
daPage.src = daPath + "nav_" + daPage + "_on.gif";
}
}
}
}
function SimpleSwap(daImage, daSrc){
var objStr,obj;
//alert ("now entering simple swap");
// Check to make sure that images are supported in the DOM.
if(document.images){
// Check to see whether you are using a name, number, or object
if (typeof(daImage) == 'string') {
// This whole objStr nonesense is here solely to gain compatability
// with ie3 for the mac.
objStr = 'document.' + daImage;
obj = eval(objStr);
obj.src = daSrc;
} else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
daImage.src = daSrc;
}
}
}
//
</script>
am trying to fix a webpage/javascript that i didn't write
www.deltaneutral.com when invoked or any new page from the menu, get the
error msg
line 2
char 1
syntax error
code 0
there is a java scipt file invoked early on that 'seems' to be the problem,
its just after the body tag
<script language=javascript src=/scripts/swap.js></script>
the code is at the end of this post
however, when i embed the code directly in the page, instead of the file
reference, the error goes away
and the functions seem to execute ok
i have checked the .js file with a hex editor looking for hidden weird bytes
but havent' found any
that look out of the ordinary, so i'm stumped why the seemingly same code
gets the error msg
only when it is invoked via its .js file
also i have loaded the html and .js file on a different, 2nd web server just
to be sure that somehow
the primary server isn't somehow supplying the .js file with a funny byte
<script type="text/javascript">
//alert ("now entering swap2ansi");
function WM_imageSwap(daImage, offOn){
var daPath = "images/";
var daPage = "home";
// Check to make sure that images are supported in the DOM.
if(document.images){
// Check to see whether you are using a name, number, or object
if (typeof(daImage) == 'string') {
// This whole objStr nonesense is here solely to gain compatability
// with ie3 for the mac.
objStr = 'document.' + daImage;
obj = eval(objStr);
srcStr = daPath + "nav_" + daImage + "_" + offOn + ".gif";
//srcEval = eval(daPath);
obj.src = srcStr;
objStr2 = 'document.' + daPage;
obj2 = eval(objStr2);
if (offOn == "on") {
srcStr2 = daPath + "nav_" + daPage + "_off.gif";
obj2.src = srcStr2;
} else {
srcStr2 = daPath + "nav_" + daPage + "_on.gif";
obj2.src = srcStr2;
}
} else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
daImage.src = daPath + "nav_" + daImage + "_" + offOn + ".gif";
if (offOn == "on") {
daPage.src = daPath + "nav_" + daPage + "_off.gif";
} else {
daPage.src = daPath + "nav_" + daPage + "_on.gif";
}
}
}
}
function SimpleSwap(daImage, daSrc){
var objStr,obj;
//alert ("now entering simple swap");
// Check to make sure that images are supported in the DOM.
if(document.images){
// Check to see whether you are using a name, number, or object
if (typeof(daImage) == 'string') {
// This whole objStr nonesense is here solely to gain compatability
// with ie3 for the mac.
objStr = 'document.' + daImage;
obj = eval(objStr);
obj.src = daSrc;
} else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
daImage.src = daSrc;
}
}
}
//
</script>