473,396 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

html editor with preview

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);}

Mar 8 '06 #1
2 1667
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>

Mar 8 '06 #2
JRS: In article <47************@individual.net>, dated Wed, 8 Mar 2006
12:04:18 remote, seen in news:comp.lang.javascript, Gernot Frisch
<Me@Privacy.net> 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.
Mar 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: John Smith | last post by:
I was wondering what is the best PHP Editor to use that will allow in program preview of the scripts. I need one for the following two OSs: Linux - KDE / Gnome Windows 2000 I would like to...
2
by: Charles | last post by:
Hi folks, I am desperatly looking for a WYSIWYG HTML editor for a textarea, using JavaScript and that'll work with Opera. I want this editor to use for a webmail program in PHP, and allow users...
20
by: Al Moritz | last post by:
Hi all, I was always told that the conversion of Word files to HTML as done by Word itself sucks - you get a lot of unnecessary code that can influence the design on web browsers other than...
4
by: Ratsky | last post by:
HELP! I have used many HTML editors but have not found one that handles PHP pages well. Coffee Cup HTML editor used to be my HTML editor of choice, but it will not open pages with the .php...
71
by: tomy_baseo | last post by:
I'm new to HTML and want to learn the basics by learning to code by hand (with the assistance of an HTML editor to eliminate repetitive tasks). Can anyone recommend a good, basic HTML editor that's...
5
by: Jane Doe | last post by:
Hi, Does anyone know of a cheap/free truely WYSIWYG (no HTML/Preview thingie) HTML embeddable widget, similar to the RichEdit widget? Googling a while returned either - browsed-based HTML...
20
by: Rick Cook | last post by:
I'm looking for a good (non-wysiwyg) editor for HTML and CSS. I want something that will help me produce non-dynamic pages with a minimum of excrescences (no, javascript, flash, etc.) in...
5
by: Jay | last post by:
I need suggestions on how to provide a simple editor for Users to enter text with paragraphs, bold, and lists into a web form. Current asp.net classes -- have I missed something? Shareware...
0
by: xmlBlueprint Team | last post by:
Dear community, xmlBlueprint XML Editor 4.2.1017 is now available for free download at: http://www.xmlblueprint.com/Download.htm. This release makes it easier to edit, validate, transform and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.