Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: setInnerHtml doesnot work in Firefox

  1. #1
    Join Date
    Dec 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default setInnerHtml doesnot work in Firefox

    Hi does any one knows replacement of setInnerHtml function as it doesnot work in Firfox and gives error.

    regards,

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    There's no such function in any browser, so far as I (and Google) are aware. You'd set the innerHTML property of the element instead. However, it's not advised to do so -- use DOM methods instead.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Dec 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re

    May Be!........ Actually i am using online web editor (like we are using for this forum) so using Java Script i am setting some value in editor... method innerhtml i think overwrites each time when function is called i dont want previous contents to be removed i want it to be there n a way from which i can insert my text on the this text Area..... So Basic purpose is just to insert some text on the top of textarea with the previous content present there..

    regrads,

  4. #4
    Join Date
    Dec 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re

    i m using code like this
    FCK.SetInnerHtml = function( html ) // IE Only
    {
    var oDoc = FCK.EditorDocument ;

    oDoc.body.innerHTML = '<div id="__fakeFCKRemove__">&nbsp;</div>' + html ;
    }
    Firefox says that SetInnerHtml is not a function but there is no problem in IE... i think there is some problem in function defination.

    regards,

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Is the // IE Only comment part of the code, or have you added? If the former, I would suspect that that is your problem. If the latter, I must ask whether you are calling SetInnerHtml() or FCK.SetInnerHtml(). Either way, I would recommend you use DOM methods over innerHTML, dropping said editor if it becomes necessary.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Code:
    method innerhtml i think overwrites each time when function is called
    Simply do:
    Code:
    oDoc.body.innerHTML += ...
    But as Twey said, stick to the DOM methods.
    - Mike

  7. #7
    Join Date
    Dec 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re

    Thank You for Your Support.... Actually Problem stands here.. Please have a look..
    this code is not working for me actually i am not a js expert just beginner so need your help to implement this code please check the code below you may have better idea whats going on..

    Code:
    function FCKeditorAPI_GetInstance( instanceName )
    {
    return this.__Instances[ instanceName ] ;
    }
    
    if ( !window.parent.FCKeditorAPI )
    {
    // Make the FCKeditorAPI object available in the parent window.
    FCKeditorAPI = window.parent.FCKeditorAPI = new Object() ;
    FCKeditorAPI.__Instances = new Object() ;
    
    
    // Function used to get a instance of an existing editor present in the
    // page.
    FCKeditorAPI.GetInstance = FCKeditorAPI_GetInstance ;
    }
    
    and then this Code
    
    var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
    var letterText.........
    oEditor.SetInnerHtml(textver1);
    there is error oEditor.SetInnerHtml(textver1); is not a function

    Actually Its FCK Editor App ... You may find complete code by searching on google with keywords "FCKEditor"

    regards,

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    method innerhtml i think overwrites each time when function is called
    Simply do:
    Code:
    oDoc.body.innerHTML += ...
    It still overwrites. This is one of the main problems with innerHTML.
    Actually Its FCK Editor App ... You may find complete code by searching on google with keywords "FCKEditor"
    We'd rather not. This appears to be a question specific to this FCKEditor (which isn't a DD script) and so isn't really appropriate here. I suggest you ask the developers of FCKEditor for support.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Dec 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    We'd rather not. This appears to be a question specific to this FCKEditor (which isn't a DD script) and so isn't really appropriate here. I suggest you ask the developers of FCKEditor for support.
    FCKEditor is written in JavaScript... So its pure JS Problem i think this is appropiate place for my Question...... Your Help is Always Appriciated.

    regards,

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No, it's no more a pure JS problem than a problem with Windows is a pure C problem.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •