AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi get outter HTML from selected text
Thema durchsuchen
Ansicht
Themen-Optionen

get outter HTML from selected text

Ein Thema von mr_fahrrad · begonnen am 16. Jan 2007 · letzter Beitrag vom 16. Jan 2007
Antwort Antwort
mr_fahrrad

Registriert seit: 28. Dez 2006
46 Beiträge
 
#1

get outter HTML from selected text

  Alt 16. Jan 2007, 16:57
How i make to get the outer html from selected text?

example

<font color="#123456"> example text, this is selected, bla bla bla</font>

the text 'this is selected' is selected, so i get the outer text (the full line above

how i make this?
  Mit Zitat antworten Zitat
Benutzerbild von 3_of_8
3_of_8

Registriert seit: 22. Mär 2005
Ort: Dingolfing
4.129 Beiträge
 
Turbo Delphi für Win32
 
#2

Re: get outter HTML from selected text

  Alt 16. Jan 2007, 17:01
I guess you're talking about JavaScript.

In JavaScript, there are several possibilities, depending on the specific browser.

The Mozilla/Firefox solution looks like this:
Code:
    var selstart=txtarea.selectionStart;
    var selend=txtarea.selectionEnd;
    if (selstart<selend) {
      selection=txtarea.value.substring(selstart, selend);
    } else {
      selection="";
    }
And this seems to work in most of the other browsers:
Code:
selection=document.selection.createRange().text;
Manuel Eberl
„The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.“
- Terry Pratchett
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:25 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz