Results 1 to 3 of 3

Thread: forum elements

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default forum elements

    I am looking for a JavaScript code that will allow me to prepend and append highlighted text in a form with HTML tags.
    Last edited by james438; 08-29-2007 at 09:41 PM.

  2. #2
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    I asked that same question -- twice -- and got no answer. . . *sigh* But I found a start for you (only works in IE; I know, I know, thats really lame, but hey, it's a start.):

    Code:
    function PlaceTag(tag){
            var selectedText = document.selection.createRange().text;
            if (selectedText != "") {
                var newText = "(" + tag + "]" + selectedText + "[" + tag + ")";
                document.selection.createRange().text = newText;
            } else {
            	input = document.getElementById("input");
    			input.value = input.value + "("+tag+"]["+tag+")";
            }
    }
    Last edited by Jas; 08-29-2007 at 05:42 AM. Reason: typo
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    It is a place to start, thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •