Hi, I got some problem using a html script codes working my browser but not
in a tidder. I need a help to pull me out.
<html>
<button onclick="javascript:formatText('b')"><b>b</b></button>
<button onclick="javascript:formatText('i')"><i>i</i></button>
<button onclick="javascript:formatText('u')"><u>u</u></button>
<button onclick="javascript:formatText('')">Red</font></button>
<textarea rows="10" placeholder="Give it a try here." id="motdtext"
style="margin: 0px 60px 9px 60px; height: 110px; width: 500px;"></textarea>
<script>
function formatText(tag) {
var Field = document.getElementById('motdtext');
var val = Field.value;
var selected_txt = val.substring(Field.selectionStart,
Field.selectionEnd);
var before_txt = val.substring(0, Field.selectionStart);
var after_txt = val.substring(Field.selectionEnd, val.length);
Field.value = before_txt + '<' + tag + '>' + selected_txt + '</' + tag +
'>' + after_txt;
}
</script>
</html>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.