Hi,
I am making a textarea for people to add/modify their text for
descriptions products. I want to have buttons (or just text links)
with functions that will allow them to bold, italicize, sup, sub, etc
the text they have selected.
This is what I have come up with so far, it's not working though.
===========================================
<script language="JavaScript">
<!--
function createIt(Do1) {
myTextRange = document.News.NewsStory.createTextRange();
var newContent = "<" + Do1 + ">" + myTextRange + "</" + Do1 + ">";
document.News.NewsStory.value = newContent;
}
// -->
</script>
<body bgcolor="White" text="Black" id="myBody">
<form action="f_upload.htm" method="POST" name="News">
<textarea cols="46" rows="10" name="NewsStory"></textarea>
<img src="images/icons_fontB.gif"
onMouseOut="this.src='images/icons_fontB.gif'"
onMouseOver="this.src='images/icons_fontB2.gif'"
onClick="createIt('b');" alt="Bold">
<img src="images/icons_fontU.gif"
onMouseOut="this.src='images/icons_fontU.gif'"
onMouseOver="this.src='images/icons_fontU2.gif'"
onClick="createIt('u');" alt="Underline">
etc ...
</form>
===========================================
First off, is there code available out there that I can use? Otherwise
can someone let me know what I'm doing wrong here? The use of
createTextRange could be misused. Right now when I try this function I
get <b>[object]</b> if I click on and text and the bold link.
Any clues?
thnx 4 1954
Dru wrote: Hi,
I am making a textarea for people to add/modify their text for descriptions products. I want to have buttons (or just text links) with functions that will allow them to bold, italicize, sup, sub, etc the text they have selected.
This is what I have come up with so far, it's not working though.
===========================================
<script language="JavaScript"> <!-- function createIt(Do1) { myTextRange = document.News.NewsStory.createTextRange(); var newContent = "<" + Do1 + ">" + myTextRange + "</" + Do1 + ">";
document.News.NewsStory.value = newContent; } // --> </script>
<body bgcolor="White" text="Black" id="myBody">
<form action="f_upload.htm" method="POST" name="News">
<textarea cols="46" rows="10" name="NewsStory"></textarea>
<img src="images/icons_fontB.gif" onMouseOut="this.src='images/icons_fontB.gif'" onMouseOver="this.src='images/icons_fontB2.gif'" onClick="createIt('b');" alt="Bold">
<img src="images/icons_fontU.gif" onMouseOut="this.src='images/icons_fontU.gif'" onMouseOver="this.src='images/icons_fontU2.gif'" onClick="createIt('u');" alt="Underline">
etc ...
</form>
===========================================
First off, is there code available out there that I can use? Otherwise can someone let me know what I'm doing wrong here? The use of createTextRange could be misused. Right now when I try this function I get <b>[object]</b> if I click on and text and the bold link.
Any clues?
thnx
I've only picked pu js these past six months or so - thus I don't know
if my help is worth anything however, if I were debugging the script,
I'd first put an alert(Do1); at the begining of createIt() function to
ensure the value is being passed - I'm wondering if your newContent
variable should have Do1.value instead of Do1
Secondly... myTextRange - Can you hardcode a value for this first - then
test its result using another alert box (again in the createIt()
function) because I'm also wondering if another function you've written
and not noted above called createTextRange() has problems...
Sorry that I have no real answers for you - but those two area's are two
I'd be looking at to ensure they have their expected values...
Hope something there helps,
randelld
Dru wrote: I am making a textarea for people to add/modify their text for descriptions products. I want to have buttons (or just text links) with functions that will allow them to bold, italicize, sup, sub, etc the text they have selected.
I have some working examples I've collected in the last 5 years, you can
apply bold, italic, underline, left, center, right, bulleted list, font:
family, size and color. I incluced graphics where I had them. If you're
interested I posted them here (warning: free Tripod server has annoying
popups and cookies).
mscir.tripod.com/email
Mike
I'll take a look at these, thnx!
On Wed, 14 Apr 2004 17:43:41 -0700, mscir
<ms***@access4less.com.net.org.uk> wrote: Dru wrote: I am making a textarea for people to add/modify their text for descriptions products. I want to have buttons (or just text links) with functions that will allow them to bold, italicize, sup, sub, etc the text they have selected.
I have some working examples I've collected in the last 5 years, you can apply bold, italic, underline, left, center, right, bulleted list, font: family, size and color. I incluced graphics where I had them. If you're interested I posted them here (warning: free Tripod server has annoying popups and cookies).
mscir.tripod.com/email
Mike
Dru wrote: I'll take a look at these, thnx!
On Wed, 14 Apr 2004 17:43:41 -0700, mscir <ms***@access4less.com.net.org.uk> wrote:
I found a nice simple one here, might be worth a look if you don't have
something you like working yet: http://devedge.netscape.com/viewsource/2003/midas/01/
scroll down near the bottom of the page:
Example 2
The second example is a simple rich text editing page, where text can be
bolded/italicized/underlined, new links can be added and the color of
text changed. The example page consists of an iframe, which will be the
rich editing area, as well as elements for basic editing commands such
as bold/italics/text color. Also provided is a "view source" button that
will display the generated code in the iframe's document. The example
can be found here.
Mike This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Razzbar |
last post by:
I have a textarea and some buttons. The buttons apply functions to
the text the user selects, i.e. the good old "wrap with a tag"
thing we all have seen in 100 different editors.
Trouble is,...
|
by: Dan |
last post by:
Can anyone offer suggestions on how to do this or if it is possible?
I have a form that uses a drop down box and 2 text fields.
What I am trying to do is have the value of each text box set by...
|
by: Mark Kolber |
last post by:
I did a little searching on this but couldn't find an answer...
On my website, I have a section of stories
(www.midlifeflight.com/stories) There are different stores on
different pages that are...
|
by: jonathon |
last post by:
I have a table of line-style entries, much like webmail. When the user
double-clicks on a line, a box pops up to enter the data for that
entry.
The problem is, whatever word they clicked on in...
|
by: McKirahan |
last post by:
Firefox does not reflect selected option via innerHTML
How do I get Firefox to reflect selected option values?
<html>
<head>
<title>FFinner.htm</title>
<script type="text/javascript">...
|
by: sathyashrayan |
last post by:
Following are the selected thread from the date:30-jan-2005 to
31-jan-2005. I did not use any name because of the subject is important.
You can get the original thread by typing the subject...
|
by: Jerry |
last post by:
We have a 10-question quiz for kids, each question being a yes or no
answer using radio selections. I'd like to keep a current total of
yes's and no's at the bottom of the quiz (if the user selects...
|
by: destiny007 |
last post by:
can any one help me to write code to capture selected text from a page but problem is that i am not able to decide where to call the functio.in this case the function is called in all cases of mouse...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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...
|
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...
| |