[thelist] Javascript: Preview a textarea in another window

Bill Moseley moseley at hank.org
Sat Jan 28 14:29:04 CST 2006


On Sat, Jan 28, 2006 at 08:36:13PM +0200, VOLKAN ÖZÇEL?K wrote:
> Seems like overcomplicating things,

That's often the problem.


> 
> Why don't you open a server-side page with a real onload handler and
> use a reference to the opener instead of overriding the onload event
> from the page that opens it.

Thanks, that works great.

I don't know the id of the textarea ahead of time, but I can pass it
though the server in a CGI parameter.


<script type="text/javascript">
    Event.observe(window, 'load', processOpener, false);

    function processOpener(){
        $('preview').innerHTML = opener.$('[% c.req.param('textarea') %]' ).value;

        window.focus();
    }
</script>

Window does not focus, though.  I also tried this.focus().  Seems
like that's what people use to bring windows back on top.

Still, I'd like to figure out how to pass the text area through the
server in a POST.  I'd like to be able to process the textarea before
opening the preview window.

Thanks for the help,


-- 
Bill Moseley
moseley at hank.org




More information about the thelist mailing list