Autor Beitrag
Ivo@CoMRoK
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 258

Win XP
D3 Prof., D7 Pe.
BeitragVerfasst: Mo 12.06.06 19:08 
Hi!
Hat jemand ne ahnung wie ich in Java
ausblenden Delphi-Quelltext
1:
Memo.SelText := '<'+S+'>'+Memo.SelText+'</'+S+'>';					

hinkrieg? [das is da so unglaublich kompliziert hab ich das gefühl :roll: ]
Ich habs schon mit
ausblenden Quelltext
1:
window.document.Textfeld.Display.selected = '<'+S+'>'+window.document.Textfeld.Display.getselection()+'</'+S+'>';					

und
ausblenden Quelltext
1:
window.document.Textfeld.Display.getselection() = '<'+S+'>'+window.document.Textfeld.Display.getselection()+'</'+S+'>';					

probiert aber das klappt nicht.
Ich kenn mich noch nicht so [ :wink: ] gut mit Java aus (wie mit Delphi. Is ja auch einfacher: man vergleiche nur mal die Sources).


Moderiert von user profile iconChristian S.: Topic aus Sonstiges (Delphi) verschoben am Mo 12.06.2006 um 21:10

_________________
Fällt der Bauer tot vom Traktor, stand am Waldrand ein Reaktor.
Ein altes indianisches Sprichwort besagt:Es kann gefährlich sein gelben Schnee zu essen.
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Mo 12.06.06 19:13 
Du musst die Strings mit
" umschließen, nicht mit '. Ich lerne grad auch erst das Schreiben von einfachsten Java-Applets, daher kann ich dir jetzt nicht sagen, obs mit der Groß- und Kleinschreibung oder so stimmt (schau nochmal nach!). Und was sagt eigentlich der Compiler?

_________________
Programmers never die, they just GOSUB without RETURN
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mo 12.06.06 19:14 
Es sieht mir eher nach JavaScript aus (DOM-Modell).

_________________
Markus Kinzler.
Ivo@CoMRoK Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 258

Win XP
D3 Prof., D7 Pe.
BeitragVerfasst: Mo 12.06.06 19:23 
Ja is Java-Script; richtig erkannt.
Aber die " warens nicht es passiert immer noch nichts.

_________________
Fällt der Bauer tot vom Traktor, stand am Waldrand ein Reaktor.
Ein altes indianisches Sprichwort besagt:Es kann gefährlich sein gelben Schnee zu essen.
Ivo@CoMRoK Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 258

Win XP
D3 Prof., D7 Pe.
BeitragVerfasst: Mo 12.06.06 22:02 
Also ich habs ez.
Hier der Source wers ausprobiern will, infach in html. (Sollte aber bekannt sein :D ):

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  <script type="text/javascript">
<!--
function insert(aTag, eTag) {
  var input = document.forms['formular'].elements['eingabe'];
  input.focus();
  /* für Internet Explorer */
  if(typeof document.selection != 'undefined') {
    /* Einfügen des Formatierungscodes */
    var range = document.selection.createRange();
    var insText = range.text;
    range.text = aTag + insText + eTag;
    /* Anpassen der Cursorposition */
    range = document.selection.createRange();
    if (insText.length == 0) {
      range.move('character', -eTag.length);
    } else {
      range.moveStart('character', aTag.length + insText.length + eTag.length);      
    }
    range.select();
  }
  /* für neuere auf Gecko basierende Browser */
  else if(typeof input.selectionStart != 'undefined')
  {
    /* Einfügen des Formatierungscodes */
    var start = input.selectionStart;
    var end = input.selectionEnd;
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
    /* Anpassen der Cursorposition */
    var pos;
    if (insText.length == 0) {
      pos = start + aTag.length;
    } else {
      pos = start + aTag.length + insText.length + eTag.length;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
  }
  /* für die übrigen Browser */
  else
  {
    /* Abfrage der Einfügeposition */
    var pos;
    var re = new RegExp('^[0-9]{0,3}$');
    while(!re.test(pos)) {
      pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
    }
    if(pos > input.value.length) {
      pos = input.value.length;
    }
    /* Einfügen des Formatierungscodes */
    var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
    input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
  }
}
//-->
</script>
  </head>
  <body>
<form name="formular" action="">
    <p><textarea name="eingabe" cols="30" rows="10">Ihre Nachricht</textarea></p>
    <p><input type="button" value="Link einfügen" onClick="insert('[link]', '[/link]')"></p>
  </form>
  </body>
</html>


[!]Wär doch auch mal was für unser "Antwort schreiben" dann müsst man des mit den Links net immer mühselig selbstschreiben :wink:[/!]

PS: Den Source hab ich von Self-HTML

_________________
Fällt der Bauer tot vom Traktor, stand am Waldrand ein Reaktor.
Ein altes indianisches Sprichwort besagt:Es kann gefährlich sein gelben Schnee zu essen.
milchoma
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Mo 26.06.06 15:21 
Titel: Problem wenn kein Button sondern Image
Hallo!

Erst mal danke für den Beitrag, ist genau was ich suche.
Hab ihn gleich in mein Forum eingebaut. Klappt auch gut.

Jetzt möchte ich keine Buttons sondern Bilder. Mein Versuch:

<input type="image" src="<%= strImagePath %>post_button_quote.gif" onClick="insert('[Quote]', '[/Quote]')" BORDER="0" width="25" height="24">

Das Problem ist, dass beim Daraufklicken das Quote eingefügt und das Formular abgeschickt wird. Verwende ich den Button hier gibt's keine Probleme und nur das Quote wird eingefügt.

<input type="button" onClick="insert('[Quote]', '[/Quote]')">

Kann jemand helfen?

vg milchoma