Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-20-2009, 11:28 PM   PM User | #1
ayyyy
New to the CF scene

 
Join Date: Jul 2009
Posts: 3
Thanks: 3
Thanked 0 Times in 0 Posts
ayyyy is an unknown quantity at this point
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
ayyyy is offline   Reply With Quote
Old 10-21-2009, 08:16 PM   PM User | #2
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
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>
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Users who have thanked glenngv for this post:
ayyyy (10-21-2009)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:08 AM.


Advertisement
Log in to turn off these ads.