Andre: div mit JavaScript über DOM eine Breite zuweisen

Beitrag lesen

Guten Morgen,

ich habe ein Problem:

Ich möchte einem DIV eine Breite, maximale Breite und minimale Breite mit JavaScript über das DOM zuweisen.

Allerdings macht der IE das nicht, das DIV geht über das komplette Fenster.

Hier ist mein Code:

var widthDiv="auto";
          var min_widthDiv="144px";
          var max_widthDiv="350px";

myDiv.id="myDiv";
          myDiv.style.width = widthDiv;
          myDiv.style.minWidth = min_widthDiv;
          myDiv.style.maxWidth = max_widthDiv;
          myDiv.style.backgroundColor = backgroundDiv;
          myDiv.style.border = borderDiv+'px solid '+bordercolorDiv;
          myDiv.style.position = 'absolute';
          myDiv.style.top = positionY+"px";
          myDiv.style.left = positionX+"px";
          arbeitsbereich.appendChild(myDiv);

Habt ihr da eine Lösung?

Danke,

viele Grüße

André