Autor |
Beitrag |
Marco D.
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Fr 05.10.07 22:57
Ich möchte HTML-Code zwischenspeichern, um diesen mit JavaScript clientseitig auszulesen und auf der geladenen Webseite anzuzeigen. Ich könnte dies in einer Variable oder in einem input-type=hidden tun, jedoch enthält dieser Code auch ' und ", darum kann ich diesen Code selbst nicht im eigentlichen HTML-Code unterbringen, da es dann zu "Verwirrungen" der Strings kommt.
Wie soll ich nun vorgehen?
_________________ Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
|
|
Lannes
Beiträge: 2352
Erhaltene Danke: 4
Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
|
Verfasst: Sa 06.10.07 00:10
Hallo,
willst Du den HTML-Code mit writeln ausgeben, dann kommst Du damit weiter:
Quelltext
_________________ MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
|
|
Jakob_Ullmann
Beiträge: 1747
Erhaltene Danke: 15
Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
|
Verfasst: Sa 06.10.07 08:55
Wenn du PHP kannst, könnte dir hier preg_replace nützlich sein (richtig, du musst ' in \' und " in \" umwandeln).
|
|
Marco D.
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Sa 06.10.07 13:41
Also wenn ich z.B. ein hidden-Feld habe:
Quelltext 1:
| <input type='hidden' id='foo' value='Dies ist ein voellig belangloser Content mit Apostrophen \' \"' /> |
Das funzt dann? D.h., kann ich dann im JS mit document.getElementById('foo').value folgenden Content bekommen:
Dies ist ein voellig belangloser Content mit Apostrophen ' " ??
_________________ Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
|
|
Jakob_Ullmann
Beiträge: 1747
Erhaltene Danke: 15
Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
|
Verfasst: Sa 06.10.07 13:48
Ich hab's nicht ausprobiert, aber theoretisch ja.
|
|
Heiko
Beiträge: 3169
Erhaltene Danke: 11
|
Verfasst: So 07.10.07 11:26
Jain,
was soll rauskommen? Denn das \' wird auch '. Wenn du also das \ ausgegeben haben willst, musste \\ machen.
|
|
|