They word "class" in JavaScript is a reserved word, that could be
causing the problem. To reference the "class" of a DOM object in "raw"
JavaScript you actually use "className".

Having said that, I suggest you use a little more of a jQuery approach
and try something like this:

function change_users_display() {
  var users = $('#users');
  var classical = $('#change_users_display_classical');
  var cloud = $('#change_users_display_cloud');

  if ( users.is('.users_cloud') ) {
    users.removeClass('users_cloud');
    classical.show();
    cloud.hide();
  } else {
    users.addClass('users_cloud');
    classical.hide();
    cloud .show();
  }

  return true;
}

Karl Rudd

On Dec 2, 2007 11:14 AM, Gordan <[EMAIL PROTECTED]> wrote:
>
> I'm loosing my mind over this :-(
> http://www.writesomething.net/users/ ("show classical users list"
> link)
> I have a few lines of code which are extremly simple and work as
> expected in FF, but IE is refusing to cooperate :-(
> I tried literally everything but it just returns the "expected
> identifier, string or number" error.
> Please help, this has to be some simple bug that I'm overseeing :-
> ( thank you
> here's the complete code, and I use the latest 1.2.1 jQuery: (IE says
> that the error is on the 3rd line)
>
> function change_users_display() {
> if ($('#users').attr('class') == 'users_cloud') {
> $('#users').attr({class: ''});
> $('#change_users_display_classical').show();
> $('#change_users_display_cloud').hide();
> } else {
> $('#users').attr({class: 'users_cloud'});
> $('#change_users_display_classical').hide();
> $('#change_users_display_cloud').show(); }
> return true; }
>

Reply via email to