Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   IE ругается, объясните причину (https://javascript.ru/forum/jquery/11873-ie-rugaetsya-obyasnite-prichinu.html)

Invis1ble 18.09.2010 22:05

IE ругается, объясните причину
 
Привет всем!!! Есть такой js-скрипт (я в js новичок, поэтому ногами не бейте):
function ResetEdit()
{
  editForm.empty();
  editableBlock.slideUp(600);

  addCommentForm.load('?page=comment-add' , {}, function()
  {
    jQuery('input#comment-add').click(function()
    {
      RefreshCommentAddForm();
    })
  })

  formHeader.text('ДОБАВЛЕНИЕ КОММЕНТАРИЯ');
}

function RefreshCommentAddForm()
{
  var comment = jQuery('textarea:last').val();

  addCommentForm.load('?page=comment-add&tid=' + tid + '&offset=' + offset, {comment: comment}, function()
  {
    var location = jQuery('input#redirect-location').val();

    if (location != undefined)
      window.location.reload(location);
    else
    {
      jQuery('input#comment-add').click(function()
      {
        RefreshCommentAddForm();
      })
    }
  })
}

function RefreshCommentEditForm()
{
  var edComment = jQuery('textarea#comment').val();

  editForm.load('?page=comment-edit&tid=' + tid + '&offset=' + offset + '&id=' + id, {comment: edComment}, function()
  {
    var location = jQuery('input#redirect-location').val();

    if (location != undefined)
    {
      editableBlock.slideUp(600);
      window.location.reload(location);
    }
    else
    {
      jQuery('input#comment-edit').click(function()
      {
        RefreshCommentEditForm();
      })
    }
  })
}

function RefreshTopicEditForm()
{
  editForm.load('?page=topic-edit&tid=' + tid, {topic_name: jQuery('input#topic-name').val(), topic_description: jQuery('input#topic-description').val(), topic_message: jQuery('textarea#topic-message').val()}, function()
  {
    var location = jQuery('input#redirect-location').val();
    
    if (location != undefined)
    {
      editableBlock.slideUp(600);
      window.location.reload(location);
    }
    else
    {
      jQuery('input#topic-edit').click(function()
      {
        RefreshTopicEditForm();
      })
    }
  })
}

function RefreshMessageEditForm()
{
  editForm.load('?page=topic-edit&tid=' + tid, {topic_message: jQuery('textarea#topic-message').val()}, function()
  {
    var location = jQuery('input#redirect-location').val();

    if (location != undefined)
    {
      editableBlock.slideUp(600);
      window.location.reload(location);
    }
    else
    {
      jQuery('input#topic-edit').click(function()
      {
        RefreshMessageEditForm();
      })
    }
  })
}

jQuery(document).ready(function()
{
  addCommentForm = jQuery('#add-comment-form');
  editableBlock = jQuery('#editableBlock');
  editForm = jQuery('#edit-form');
  formHeader = jQuery('#formHeader');

  tid = jQuery('input#tid').val();
  offset = jQuery('input#offset').val();

  editableBlock.hide();

  addCommentForm.load('?page=comment-add' , {}, function()
  {
    jQuery('input#comment-add').click(function()
    {
      RefreshCommentAddForm();
    })
  })

  jQuery('a.comment-edit').click(function()
  {
    var link = jQuery(this);
    id = link.attr('id');
    var block = link.parent().parent();

    editableBlock.html(
      '<div class="editHeader">редактируемый комментарий | ' +
      '<a class="ResetEdit" onclick="ResetEdit();" href="javascript: void(0);">' +
      'отменить редактирование</a></div>').append(jQuery('#comment-content', block).html());

    editForm.load('?page=comment-edit&id=' + id, {}, function()
    {
      jQuery('input#comment-edit').click(function()
      {
        RefreshCommentEditForm();
      })
    })

    formHeader.text('РЕДАКТИРОВАНИЕ КОММЕНТАРИЯ');
    addCommentForm.empty();
    editableBlock.slideDown(600);
  })

  jQuery('a.comment-delete').click(function(event)
  {
    var responce = confirm('Вы действительно хотите удалить этот комментарий?');
    if (!responce) event.preventDefault();
  })

  jQuery('a.topic-edit').click(function()
  {
    var blockHtml = jQuery('#captionTopicName').html() + '<br />' +
                    jQuery('#captionTopicDescription').html() + '<br />' +
                    jQuery('#topic-message').html();

    editableBlock.html(
      '<div class="editHeader">редактируемая тема | ' +
      '<a class="ResetEdit" onclick="ResetEdit();" href="javascript: void(0);">' +
      'отменить редактирование</a></div>').append(blockHtml);

    editForm.load('?page=topic-edit&tid=' + tid, {}, function()
    {
      jQuery('input#topic-edit').click(function()
      {
        RefreshTopicEditForm();
      })
    });

    formHeader.text('РЕДАКТИРОВАНИЕ ТЕМЫ');
    addCommentForm.empty();
    editableBlock.slideDown(600);
  })

  jQuery('a.topic-delete').click(function()
  {
    var responce = confirm('Вы действительно хотите удалить эту тему?');
    if (!responce) event.preventDefault();
  })

  jQuery('a.message-edit').click(function()
  {
    var blockHtml = jQuery('#topic-message').html();

    editableBlock.html(
      '<div class="editHeader">редактируемое сообщение | ' +
      '<a class="ResetEdit" onclick="ResetEdit();" href="javascript: void(0);">' +
      'отменить редактирование</a></div>').append(blockHtml);

    editForm.load('?page=topic-edit&tid=' + tid, {}, function()
    {
      jQuery('input#topic-edit').click(function()
      {
        RefreshMessageEditForm();
      })
    });

    formHeader.text('РЕДАКТИРОВАНИЕ СООБЩЕНИЯ');
    addCommentForm.empty();
    editableBlock.slideDown(600);
  })
})

В опере и гугл-хроме скрипт работает нормально, IE выдает "Объект не поддерживает это свойство или метод (строка 106, символ 3)". Это он ругается на
editableBlock = jQuery('#editableBlock');

Объсните плиз, причину

MadGest 18.09.2010 22:26

Пугающий объем.....

inGray 18.09.2010 22:31

Ничего подобного... Вовсе не на эту строку... Покажите полностью вызывающий код.

Invis1ble 18.09.2010 22:57

MadGest,
объем из-за стиля написания кода
inGray,
именно на эту. Я проверял, добавляя пустые строки в код. Что имеется ввиду под "вызывающий код" ? Если js - то я привел код полностью

inGray 18.09.2010 23:05

EditForm случайно не айдишник формы?

Invis1ble 18.09.2010 23:07

inGray,
не, editForm - айдишник дива
comment-list.php
...
<div id="edit-form"></div>
...

Invis1ble 18.09.2010 23:14

точнее не айдишник дива, а объект, получаемый по id="edit-form", т.е. div

inGray 18.09.2010 23:14

Попробуйте поменять имена переменных editableBlock и editForm?

Invis1ble 18.09.2010 23:20

inGray,
просто сменить имена на другие? А разве это может быть причиной? Ведь в других браузерах все нормально работает...

inGray 18.09.2010 23:22

Да, просто сменить имена? Ругается же именно на имя переменной...


Часовой пояс GMT +3, время: 07:39.