D
Dru
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 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