Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > html editor with preview

Reply
Thread Tools

html editor with preview

 
 
Gernot Frisch
Guest
Posts: n/a
 
      03-08-2006
Hi,

I'd like to have an textarea, where I type HTML code. While typing,
I'd like to see the result at the bottom of the page (in a DIV?) to be
show.
Can you help?

--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}



 
Reply With Quote
 
 
 
 
Gernot Frisch
Guest
Posts: n/a
 
      03-08-2006
Got it - don't bother:
<html>
<head>


</head>

<body>
<form name="Input">
<textarea name="text_in" style="width:100%; height:40%">Sample
text</textarea>
<br>
<div id=b
onclick="document.getElementById('preview').innerH TML=document.Input.text_in.value">
</div>
</form>

<div id="preview">
</div>
<script language="Javascript">
var elapse = 1000; // this is interval - 1000 millisecond
function onTimer()
{
document.getElementById('preview').innerHTML=docum ent.Input.text_in.value;
timer = window.setTimeout("onTimer()",elapse);
}

onTimer();
</script>
</body>
</html>



 
Reply With Quote
 
 
 
 
Dr John Stockton
Guest
Posts: n/a
 
      03-10-2006
JRS: In article <(E-Mail Removed)>, dated Wed, 8 Mar 2006
12:04:18 remote, seen in news:comp.lang.javascript, Gernot Frisch
<(E-Mail Removed)> posted :

><body>
><form name="Input">
> <textarea name="text_in" style="width:100%; height:40%">Sample
>text</textarea>
> <br>
> <div id=b
>onclick="document.getElementById('preview').inner HTML=document.Input.text_in.val
>ue">
> </div>
></form>
>
><div id="preview">
></div>
><script language="Javascript">
> var elapse = 1000; // this is interval - 1000 millisecond
> function onTimer()
> {
> document.getElementById('preview').innerHTML=docum ent.Input.text_in.value;
> timer = window.setTimeout("onTimer()",elapse);
> }
>
> onTimer();
></script>
></body>


I suspect the onClick is redundant; and it might be better to call the
function with body onLoad.

If the HTML may include controls, and data should be put by the user
into the controls for test, then ISTM necessary to be able to turn off
the function, for otherwise the controls will probably be continually
reinitialised.

See also <URL:http://www.merlyn.demon.co.uk/js-quick.htm>, to which I
might add such a feature.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ANN: MathTran Instant Preview web-based editor for mathematics Jonathan Fine Javascript 0 04-01-2008 08:29 AM
Preview: Dystopia Preview Silverstrand Front Page News 0 02-05-2006 03:15 AM
To change the default font of HTML editor kit without altering the edited HTML Daniel Polansky Java 0 10-11-2004 05:16 PM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM



Advertisments