On 2/3/07, Sébastien Gruhier <[EMAIL PROTECTED]> wrote:
> Hi
>
> That's really weird
> I have done a sample code (using your evalCode function) for testing
> but it works fine. Could you try it? If it works, it comes from your
> code.
> Why do you use this eval code method? I would be better to have a
> simple JS function called at onclick event.
> I did it on PWC documentation because you can edit JS code online, in
> your case it does not make sense.

Agreed. I should change that. Once it was working, I had to move on to
other things and never got around to refactoring it. I'd move it
completely out to a ".js" file, but, I need it in the JSP server side
to dynamically populate contents. I could move it to the HEAD section
of dynamically generated page as a javascript function though.

> Seb
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/
> TR/xhtml11/DTD/xhtml11.dtd">
>
> <html>
> <head>
>         <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
>
>         <title>Test</title>
>
>         <script type="text/javascript" src="../javascripts/prototype.js"> </
> script>
>         <script type="text/javascript" src="../javascripts/window.js"> </
> script>
>         <script type="text/javascript" src="../javascripts/debug.js"> 
> </script>
>         <script type="text/javascript" src="../javascripts/effects.js"> </
> script>
>
>         <link href="../themes/default.css" rel="stylesheet" type="text/css"
>  >       </link>
>         <link href="../themes/alert.css" rel="stylesheet" type="text/css" >
> </link>
>         <title>Test TextArea</title>
> <body>
>
>    <div id="siteFeedback" onClick="evalCode('open_feedback'); return
> false">
>       Feedback
>    </div>
>
>    The snippet with the javascript that opens the window is here:
>
>    <div style="display:none" id="open_feedback_codediv">
>       <xmp id="open_feedback">
>                 Dialog.alert("Dialog test", {windowParameters: {width:300,
> height:100}, okLabel: "close"});
>       </xmp>
>    </div>
> <script>
>    function evalCode(id) {
>        var element = $(id);
>        var code = element.innerHTML;
>        code = code.gsub("&lt;", "<");
>        code = code.gsub("&gt;", ">");
>        eval(code);
>    }
>
> </script>
> </body>
> </html>

Hmmm. This seems logically equivalent to what I am doing already
except for the JS function evalCode being within the page directly
rather than coming from separate included JS file. It looks like I
will have to simplify my version until I find the aspect of my full
configuration of page and included JS files that is the problem. :-(

I'll report back when I have either resolved it or found a simpler
reproducable test case.

-Van

_______________________________________________
Javawin mailing list
[email protected]
http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com

Reply via email to