Hi all, I am trying to develop a simple rich text editor
I do only require bold, itlaic, underline..
The code for IE is
<script>
function displayEditor(editor, html, width, height)
{
document.writeln('<iframe id="' + editor + '" name="' + editor +
'" width="' + width + 'px" height="' + height + 'px"></iframe>');
var mainContent= '<html id="' + editor + '"><head></head><body
onkeypress=alert("Hi")>"' + html + '"</body></html>' ;
var edit = document.getElementById(editor).contentWindow.docu ment;
edit.write(mainContent);
edit.designMode = "On" ;
}
displayEditor("editor", "html", 250, 200) ;
</script>
"You can use Ctrl+B to bold, Ctrl+U to underline, Ctrl+I for Italic "
Its working fine but I wanted to know which key is pressed .
For this, I have written onkeypress event in the body tag .
But that event is not geing fired .
So what should I do here to know which key is pressed ?
Please help me out ..
Thanx in advance, 7 2951
Prasad wrote:
Hi all, I am trying to develop a simple rich text editor
I do only require bold, itlaic, underline..
The code for IE is
<script>
function displayEditor(editor, html, width, height)
{
document.writeln('<iframe id="' + editor + '" name="' + editor +
'" width="' + width + 'px" height="' + height + 'px"></iframe>');
var mainContent= '<html id="' + editor + '"><head></head><body
onkeypress=alert("Hi")>"' + html + '"</body></html>' ;
var edit = document.getElementById(editor).contentWindow.docu ment;
edit.write(mainContent);
edit.designMode = "On" ;
}
displayEditor("editor", "html", 250, 200) ;
</script>
"You can use Ctrl+B to bold, Ctrl+U to underline, Ctrl+I for Italic "
Its working fine but I wanted to know which key is pressed .
For this, I have written onkeypress event in the body tag .
But that event is not geing fired .
So what should I do here to know which key is pressed ?
Please help me out ..
Thanx in advance,
Please help me out here , I could not move anywhere until & unless I
solve this ..
If what I required is not possible , can any suggest a new method
which creates a simple editor and helps to know which is key is pressed
..
Prasad wrote:
Prasad wrote:
Hi all, I am trying to develop a simple rich text editor
I do only require bold, itlaic, underline..
The code for IE is
<script>
function displayEditor(editor, html, width, height)
{
document.writeln('<iframe id="' + editor + '" name="' + editor +
'" width="' + width + 'px" height="' + height + 'px"></iframe>');
var mainContent= '<html id="' + editor + '"><head></head><body
onkeypress=alert("Hi")>"' + html + '"</body></html>' ;
var edit = document.getElementById(editor).contentWindow.docu ment;
edit.write(mainContent);
edit.designMode = "On" ;
}
displayEditor("editor", "html", 250, 200) ;
</script>
"You can use Ctrl+B to bold, Ctrl+U to underline, Ctrl+I for Italic "
Its working fine but I wanted to know which key is pressed .
For this, I have written onkeypress event in the body tag .
But that event is not geing fired .
So what should I do here to know which key is pressed ?
Please help me out ..
Thanx in advance,
Please help me out here , I could not move anywhere until & unless I
solve this ..
If what I required is not possible , can any suggest a new method
which creates a simple editor and helps to know which key is pressed
.
Hi all, any workaround here ??
Or can I atleast know that "Enter key " is pressed while entering data
into the editor ???
Prasad wrote:
edit.write(mainContent);
edit.designMode = "On" ;
Hi,
Try to add here next code:
edit.attachEvent("onkeypress", function(event){
if (event.keyCode == 13)
alert("You pressed 'Enter'");
});
}
displayEditor("editor", "html", 250, 200) ;
</script>
Prasad wrote:
Hi all, I am trying to develop a simple rich text editor
Are you doing this because you require a rich text editor, and don't
know of any existing ones? Or are you doing this because you *want* to
do it?
If the answer to the first question is "yes", then I'd suggest you don't
reinvent the wheel ;)
--
Dylan Parry http://electricfreedom.org | http://webpageworkshop.co.uk
Programming, n: A pastime similar to banging one's head
against a wall, but with fewer opportunities for reward.
marss wrote:
Prasad wrote:
edit.write(mainContent);
edit.designMode = "On" ;
Hi,
Try to add here next code:
edit.attachEvent("onkeypress", function(event){
if (event.keyCode == 13)
alert("You pressed 'Enter'");
});
Ohhhhhh
It's working................
I am very much thankful to you ..
Its working in IE
and for Mozilla I changed to :
document.getElementById(editor).contentDocument.ad dEventListener("onkeypress",
function(event){
if (event.keyCode == 13)
alert("You pressed 'Enter'");
},false);
But its not working ..
Any thing wrong in the code?????
Thanx once again!
}
displayEditor("editor", "html", 250, 200) ;
</script>
Dylan Parry wrote:
Prasad wrote:
Hi all, I am trying to develop a simple rich text editor
Are you doing this because you require a rich text editor, and don't
know of any existing ones? Or are you doing this because you *want* to
do it?
If the answer to the first question is "yes", then I'd suggest you don't
reinvent the wheel ;)
--
Yes .. I require a rich text editor and but also I know of existing
ones ..
But I want my editor to be very simple as above..(FYI, I am not
reinventing the wheel .. I took the the existing code and modified it
as above to make it simple)..
So I "want" to do this..
Dylan Parry http://electricfreedom.org | http://webpageworkshop.co.uk
Programming, n: A pastime similar to banging one's head
against a wall, but with fewer opportunities for reward.
Prasad wrote:
marss wrote:
Prasad wrote:
edit.write(mainContent);
>
edit.designMode = "On" ;
>
Hi,
Try to add here next code:
edit.attachEvent("onkeypress", function(event){
if (event.keyCode == 13)
alert("You pressed 'Enter'");
});
Ohhhhhh
It's working................
I am very much thankful to you ..
Its working in IE
and for Mozilla I changed to :
document.getElementById(editor).contentDocument.ad dEventListener("onkeypress",
function(event){
if (event.keyCode == 13)
alert("You pressed 'Enter'");
},false);
But its not working ..
Any thing wrong in the code?????
Thanx once again!
Sorry ! it's coming for mozilla too
I used event type "onkeypress" instead of " keypress"
>
Thanx alot for helping me out
>
}
displayEditor("editor", "html", 250, 200) ;
</script>
>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: IkBenHet |
last post by:
Hello,
I found this script to create a simple rich text form
(http://programmabilities.com/xml/index.php?id=17):
<html>
<head>
<title>Rich Text Editor</title>
</head>
<body>
|
by: PC User |
last post by:
I found this Rich Text Editor and I've been trying to recreate it in
my own application. I've had trouble with the COMCTL.ImageListCtrl
and the COMCTL.Toolbar to recreate the toolbar. And I've...
|
by: VB Programmer |
last post by:
I want to create an email message with a HTML body and email it out. I know
how to create/send the email (for the most part.)
1. Any ideas or examples of using an ASP.NET rich text editor so...
|
by: EEEdiot |
last post by:
Does anyone know of a good rich text editor web control for ASP.NET that is
*free*?
TIA.
|
by: mark.macumber |
last post by:
I would like to know how people these days are creating their own rich
text editors for use in web pages. Does anyone know where to find
material on how to go about doing this? I would just like a...
|
by: pbreah |
last post by:
I'm doing a Rich Text Editor (WYSIWYG) in javascript for a game for
kids. I'm doing a special case in with every keystroke from A-Z creates
a background and foreground color for that letter, witch...
|
by: karen987 |
last post by:
My newsweblog has ASP pages with news articles and a commenting system. The comments are posted, and to read them the reader clicks on the headline of the comment, and it opens up in a pop up window....
|
by: karen987 |
last post by:
I have a web page which used to work fine until i added a rich text editor.
the pages are in ASP and it is a news weblog, with a comments section where people click the headline of a comment and...
|
by: arnabc |
last post by:
Hi all,
I am developing one online forum kind of website where users have the facility to submit there comments and to do that we r using one custom made rich text editor. So far it was fine but...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |