Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: HTML test field

  1. #1
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    3
    Thanks
    3
    Thanked 0 Times in 0 Posts

    HTML test field

    Is there a way to create a message field which I would be able to

    copy and paste a block of HTML into
    hit a button
    and a new window would pop up with that code performed?

    Any guidance would be great!!

    Thanks

    Anthony

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    It's more of a Javascript question.

    Try this:
    Code:
    <html>
    <head>
    <title>Preview</title>
    <script type="text/javascript">
    function doPreview(f){
        if (f.htmlField.value){
            var win = window.open("", "_blank", "width=600, height=400, resizable=1");
            win.document.write(f.htmlField.value);
            win.document.close();
            win.focus();
        }
    }
    </script>
    </head>
    <body>
    <form>
    <textarea name="htmlField" rows="10" cols="100"></textarea>
    <input type="button" value="Preview" onclick="doPreview(this.form);" />
    </form>
    </body>
    </html>

  • Users who have thanked glenngv for this post:

    ayyyy (10-21-2009)


  •  

    Posting Permissions

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