Adding Javascript Script element in Rich Text Editor

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sarwarmohiuddin
    New Member
    • Mar 2007
    • 1

    Adding Javascript Script element in Rich Text Editor

    Hello MAtes,
    I am having this problem of adding a script element in a rich text editor box.
    i am doing this. The problem is that it won't add the script tag alltogather, or give an error "Unknown Runtime Error".
    Its only with the script element as other elemets suscha s Div, img are all being added correctly.

    Code:
    editor = window.opener.document.getElementById('WebWizRTE');
    scr = editor.contentWindow.document.createElement('script');
    scr.setAttribute('type', 'text/javascript');
    scr.setAttribute('language', 'JavaScript');
    scr.innerHTML('var a;');
    editor.getElementById('myScript').appendChild(scr);
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to The Scripts - TSDN.

    Do you have this problem in all browsers or just IE/Firefox, etc.?

    In IE, you may need to use the text property instead.

    Comment

    Working...