|
-
anyone else hear that?
[F8] Add/remove bullets in html selection??
I've got a text field that I need to be able to add and remove bullets from using the <li> html tag. I figured out how to get the selection and wrap it with the <li> tag, but, I'm not sure how to determine if there's an <li> tag around the selection html and remove it. I would just do a split and join to remove the tags from the whole text box, but there might be two bulleted sections on one page, so I can't just remove all the bullets...
Anyone??
Sample attached...
Edit: And here's the code I'm using...as you can guess, the first part of the if statement isn't working since the <li> tag doesn't show up in the selection, since it's not html:
Code:
on (release) {
Selection.setFocus(this._parent.text_txt.text);
Selection.setSelection(this.SelBegin, this.SelEnd);
allText = this._parent.text_txt.text;
selText = allText.substring(this.SelBegin, this.SelEnd);
if (selText.substring(1, 4) == "<li>") {
initString = this._parent.text_txt.text.substring(0, this.SelBegin);
replaceString = selText.substring(5, selText.length-5);
finalString = this._parent.text_txt.text.substring(this.SelEnd, this._parent.text_txt.text.length);
this._parent.text_txt.htmlText = initString+replaceString+finalString;
} else {
initString = this._parent.text_txt.text.substring(0, this.SelBegin);
replaceString = "<li>"+this._parent.text_txt.text.substring(this.SelBegin, this.SelEnd)+"</li>";
finalString = this._parent.text_txt.text.substring(this.SelEnd, this._parent.text_txt.text.length);
this._parent.text_txt.htmlText = initString+replaceString+finalString;
}
}
Last edited by flashpipe1; 11-18-2008 at 08:44 PM.
Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|