Siri: IE8 getElementsByName liefert getElementById?

Hallo,

das nachfolgende Script zeigt im IE8 beim "alert"

listdiv4||fd7

an. Versteht das jemand? Im Firefox werden die korrekten Angaben ausgewisen.

Viele Grüße
Siri

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">  
	<head>  
		<meta charset="utf-8"/>  
		<title></title>  
	</head>  
	<body>	  
		<ul id="wrapper">  
			<li id="fd7" name="blubb" class="listdiv4"><div class="edup" name="fd7">Up</div><div class="eddown" name="fd7">Down</div></li>  
		</ul>  
		<script>
				var correspondingElementsDown = document.getElementsByName("fd7");  
				for (var x= 0; x < correspondingElementsDown.length; x++) {  
					var elementDownLoop = correspondingElementsDown[x];			  
					alert(elementDownLoop.className+"||"+elementDownLoop.id);						  
				}
		</script>  
	</body>  
</html>
  1. @@Siri:

    nuqneH

    Versteht das jemand?

    Ja. Unterschiedliche Fehlerbehandlung.

    Im Firefox werden die korrekten Angaben ausgewisen.

    Was ist korrekt? Das @name-Attibut jedenfalls nicht – weder bei li- noch bei div-Elementen.

    Qapla'

    --
    „Perfektion ist nicht dann erreicht, wenn es nichts mehr hinzuzufügen gibt, sondern wenn man nichts mehr weglassen kann.“ (Antoine de Saint-Exupéry)
    1. Hallo,

      Was ist korrekt? Das @name-Attibut jedenfalls nicht – weder bei li- noch bei div-Elementen.

      Merci.
      Bin wieder mal darauf reingefallen! Ich hasse es. Warum in aller Welt ist das so spezifiziert?!?!

      Viele Grüße
      Siri

  2. Hi,

    das nachfolgende Script zeigt im IE8 beim "alert"

    listdiv4||fd7

    an. Versteht das jemand?

    Zumindest *erstaunt* sollte darüber niemand sein, der fähig ist im MSDN nachzuchlagen – http://msdn.microsoft.com/en-us/library/ie/ms536438(v=vs.85).aspx:

    “When you use the getElementsByName method, all elements in the document that have the specified NAME attribute or ID attribute value are returned.”

    MfG ChrisB

    --
    RGB is totally confusing - I mean, at least #C0FFEE should be brown, right?
    1. Hallo,

      Zumindest *erstaunt* sollte darüber niemand sein, der fähig ist im MSDN nachzuchlagen – http://msdn.microsoft.com/en-us/library/ie/ms536438(v=vs.85).aspx:

      “When you use the getElementsByName method, all elements in the document that have the specified NAME attribute or ID attribute value are returned.”

      Es wird ja aber NUR das Element mit der ID ausgewählt und nicht beides.

      Viele Grüße
      Siri

      1. Könnte was hiermit zu tun haben, oder?

        "[...]but elements with a NAME expando are not included in the collection[...]"

        1. "[...]but elements with a NAME expando are not included in the collection[...]"

          Ja, das ist die Lösung bzw. das Problem...

      2. Hi,

        Es wird ja aber NUR das Element mit der ID ausgewählt und nicht beides.

        Dann liest du bitte an der verlinkten Stelle auch noch den *nächsten* Satz (ja, ich weiß – Aufmerksamkeitsspannen heutzutage …) – um das bestätigt zu finden, was Gunnar bereits sagte.

        MfG ChrisB

        --
        RGB is totally confusing - I mean, at least #C0FFEE should be brown, right?
        1. Dann liest du bitte an der verlinkten Stelle auch noch den *nächsten* Satz (ja, ich weiß – Aufmerksamkeitsspannen heutzutage …)

          Hast ja recht, sorry!

  3. Versteht das jemand? Im Firefox werden die korrekten Angaben ausgewisen.

    Da haben die IE-Developer halt ihren einen Standard. Muss man mit leben.