Link to home
Start Free TrialLog in
Avatar of Aphroditus
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_swapImgData;
  for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) {
    objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];
    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||
        (objStr.indexOf('document.all[')   ==0 && document.all   ==null))
      objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
    obj = eval(objStr);
   if (obj != null) {
      swapArray[j++] = obj;
      swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src: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.
ASKER CERTIFIED SOLUTION
Avatar of akf
akf

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial