yusuf: HTML Tags innerhalb JavaScript.

Hallo, ich habe das ganze Internet durchgekämmt, nirgends eine Lösung gefunden.

Wie kann ich Indizes (<sub>) in einer Zeile mit Variablen unterbringen?

Z.B.:

var x1=....;
output = "x1 = "+x1;

"1" bei x muss aber tiefgestellt sein.

In php würde es so aussehen:

$output = "x<sub>1</sub> = " . $x1;

Danke

  1. Hallo yusuf,

    Hallo, ich habe das ganze Internet durchgekämmt

    Und es fiel dir nicht wie Schuppen von den Augen?

    Wie kann ich Indizes (<sub>) in einer Zeile mit Variablen unterbringen?

    Gar nicht, du musst HTML-Elemente mittels DOM einfügen, siehe <http://de.selfhtml.org/javascript/objekte/node.htm@title=SELFHTML: node>.

    Grüße
     Roland

  2. Hallo yusuf.

    var x1=....;
    output = "x1 = "+x1;

    "1" bei x muss aber tiefgestellt sein.

    Wie wäre es mit http://de.selfhtml.org/javascript/objekte/string.htm#sub@title=sub()?

    Einen schönen Mittwoch noch.

    Gruß, Ashura

    --
    sh:( fo:} ch:? rl:( br: n4:~ ie:{ mo:| va:) de:> zu:} fl:( ss:) ls:[ js:|
    „It is required that HTML be a common language between all platforms. This implies no device-specific markup, or anything which requires control over fonts or colors, for example. This is in keeping with the SGML ideal.“
    [HTML Design Constraints: Logical Markup]
  3. Hello out there!

    output = "x1 = "+x1;
    "1" bei x muss aber tiefgestellt sein.

    Wie wäre es mit 'x₁'? [U+2070–U+209F Superscripts and Subscripts]

    See ya up the road,
    Gunnar

    --
    “Remember, in the end, nobody wins unless everybody wins.” (Bruce Springsteen)
  4. "1" bei x muss aber tiefgestellt sein.

    In php würde es so aussehen:

    $output = "x<sub>1</sub> = " . $x1;

    In Javascript sieht das fast genauso aus:
    output = "x<sub>1</sub> = " + x1;

    Struppi.

    --
    Javascript ist toll (Perl auch!)