Thanks for your reply, Bryan.
Thanks! It works like a charm!
Renee
> doc.createScriptElelment();
>
> final Document doc = Document.get();
> final ScriptElement script = doc.createScriptElement();
> script.setType("text/javascript");
> script.setText(strJavascript);
>
> On Nov 21, 8:06 pm, Renee Lau <[email protected]> wrote:
>
> > Hi
>
> > I have problem on inserting javascript under the scirpt tag.
> > I am doing a kind of dynamic form which allow users to insert some
> > simple javascript which associated with widget events.
>
> > My problem is that the code works fine in FF and Chrome but not in IE
> > browsers and after some investigation.
> > It is found that IE is not allowed some javascript features to be run
> > on its browser which will cause memory leakage.
>
> > My code is very simple and shown as below:
>
> > 1. Document document = Document.get();
> > 2. script = document.createElement("script");
> > 3. script.setAttribute("type", "text/javascript");
> > 4. script.setAttribute("id", "custom_javascript");
> > 5. script.appendChild(document.createTextNode(javascripSource));
> > 6.
> > document.getElementsByTagName("head").getItem(0).appendChild(script);
>
> > The error message caused by line 5 is:
> > Unexpected call to method or property access.
>
> > It is because IE does not allowed appendChild in script tag
>
> > so i changed to use innerText/innerHtml
> > replace line 5 to script.setInnerHTML(javaScriptSrc);
>
> > The error message is Unknown runtime error.
>
> > No matter i wrote the code in GWT or use the native method to do it in
> > javascript way. it fails.
>
> > I have search the forum and google it for days but still no luck.
> > Can anyone give me some ideas on how to fix it in IE browsers?
>
> > Thanks in advance.
>
> > Renee
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.