Aphroditus
asked on
Problem with javascript and cgi
When I write my cgi script with the print qq| |; thing,
I'd get the following error with my javascript :
CGI ERROR
========================== ========== ======
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: syntax error at ./html.pl line 627, near "))
"
Can't use subscript on constant item at ./html.pl line 630, near "++]"
Can't use subscript on constant item at ./html.pl line 631, near "++]"
Can't use subscript on constant item at ./html.pl line 631, near "1]"
Can't use subscript on constant item at ./html.pl line 631, near "j]"
Can't use subscript on constant item at ./html.pl line 632, near "2]"
syntax error at ./html.pl line 634, near "//used "
Unmatched right bracket at ./html.pl line 635, at end of line
The script is a rollover script provided by dreamweaver. Its :
function MM_swapImage() { //v2.0
var i,j=0,objStr,obj,swapArray =new Array,oldArray=document.MM _swapImgDa ta;
for (i=0; i < (MM_swapImage.arguments.le ngth-2); i+=3) {
objStr = MM_swapImage.arguments[(na vigator.ap pName == 'Netscape')?i:i+1];
if ((objStr.indexOf('document .layers[') ==0 && document.layers==null) ||
(objStr.indexOf('document. all[') ==0 && document.all ==null))
objStr = 'document'+objStr.substrin g(objStr.l astIndexOf ('.'),objS tr.length) ;
obj = eval(objStr);
if (obj != null) {
swapArray[j++] = obj;
swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.sr c:oldArray [j];
obj.src = MM_swapImage.arguments[i+2 ];
}
}
document.MM_swapImgData = swapArray; //used for restore
}
The line with swapArray was made the error...
what is wrong with the script?
Hope someone would shed some light into this.
I'd get the following error with my javascript :
CGI ERROR
==========================
Error Message : Error loading required libraries.
Check that they exist, permissions are set correctly and that they compile.
Reason: syntax error at ./html.pl line 627, near "))
"
Can't use subscript on constant item at ./html.pl line 630, near "++]"
Can't use subscript on constant item at ./html.pl line 631, near "++]"
Can't use subscript on constant item at ./html.pl line 631, near "1]"
Can't use subscript on constant item at ./html.pl line 631, near "j]"
Can't use subscript on constant item at ./html.pl line 632, near "2]"
syntax error at ./html.pl line 634, near "//used "
Unmatched right bracket at ./html.pl line 635, at end of line
The script is a rollover script provided by dreamweaver. Its :
function MM_swapImage() { //v2.0
var i,j=0,objStr,obj,swapArray
for (i=0; i < (MM_swapImage.arguments.le
objStr = MM_swapImage.arguments[(na
if ((objStr.indexOf('document
(objStr.indexOf('document.
objStr = 'document'+objStr.substrin
obj = eval(objStr);
if (obj != null) {
swapArray[j++] = obj;
swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.sr
obj.src = MM_swapImage.arguments[i+2
}
}
document.MM_swapImgData = swapArray; //used for restore
}
The line with swapArray was made the error...
what is wrong with the script?
Hope someone would shed some light into this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.