views:

500

answers:

2

i m using lightwindow using prototype.js, IE display error when lighwindow appear, i m writing lines where problem occur, please suggest me where is the error and how to rectifi it

setStyle: function(element, styles, camelized) {
    element = $(element);
    var elementStyle = element.style;

    for (var property in styles)
      if (property == 'opacity') element.setOpacity(styles[property])
      else
        elementStyle[(property == 'float' || property == 'cssFloat') ? // error show in this line
          (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
          (camelized ? property : property.camelize())] = styles[property];

    return element;
  },
+4  A: 

The prototype.js code is most likely fine, it's probably a setStyle() call on an element that doesn't exist.

If you use Internet Explorer 8, press F12 to open the developer tools. Change to the "script" tab and then find the Stack Trace. The stack trace will show you the point where the offending setStyle() call was made. That might already give you a hint wnat's wrong; if it doesn't, come back with that info.

You can do the same with Firefox and Firebug.

Pekka
in firefox this is running perfectly, and i m using IE7 with debuger script.on the other page this script running ok, with same code on IE
diEcho
Well, what does the debugger tell you?
Pekka
invalid argumnet
diEcho
What does the stack trace tell you? Where was the invalid argument made? What is the JS in that line?
Pekka
i have mentiond in the question abt that line of error(just after else), i didn't see stack trace and script debugger crashes now. i m downloading IE 8 for debugging
diEcho
You need to find the point the function was called from. Yeah, IE8 is probably the best way to go.
Pekka
thank you for support and help Mr. Pekka...... You are great Sir, Hats off
diEcho
+1 for marking up with `kbd` :D
Gordon
@Gordon: Just discovered it the other day! It's great.
Pekka
@ILP, here's another one it looks like you might want to accept?
AJ
A: 

Same problem for me, works fine in FireFox, no error, but in IE (argument not valid prototype.js line 1597).

Any solution found for this?

hN8
paste your javascript code into jslint.com , that will show you exact error... as far as i remember..there was some semicolon error..or confliction of jquery and prototype.. ru using jquery also???
diEcho