• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Bild wird auf 100% eines Frames gestreckt ==> Fehler

reinprecht

Neues Mitglied
Hey Leute :D Habe im World Wide Web ein Script gefunden das mir inerhalt eines Frames ein Foto auf die größe des Frames streckt ich habe das in 2 verschiedenen Frames ausprobiert. Aber lustiger weiße funktioniert es in einem davon nicht .... wisst ihr vllt wo hier der fehler ist ?
Code:
  [FONT=&quot]<html>[/FONT]
  [FONT=&quot]  <head>[/FONT]
  [FONT=&quot]    <title></title>[/FONT]
  [FONT=&quot]    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">[/FONT]
  [FONT=&quot]  </head>[/FONT]
  [FONT=&quot]  <body bgcolor="yellow">[/FONT]
  [FONT=&quot]      <script language="JavaScript">[/FONT]
  
  [FONT=&quot]            function makeIm() {[/FONT]
  [FONT=&quot]                NS4=(document.layers);[/FONT]
  [FONT=&quot]                IE4=(document.all);[/FONT]
  [FONT=&quot]                scaleWidth = true;[/FONT]
  [FONT=&quot]                scaleHeight = true;[/FONT]
  [FONT=&quot]                imSRC = "BILD.JPG";[/FONT]
  [FONT=&quot]                if (NS4) {[/FONT]
  [FONT=&quot]                    origWidth = innerWidth;[/FONT]
  [FONT=&quot]                    origHeight = innerHeight;}[/FONT]
  
  [FONT=&quot]                function reDo() {[/FONT]
  [FONT=&quot]                    if (innerWidth != origWidth || innerHeight != origHeight)[/FONT]
  [FONT=&quot]                        location.reload();}[/FONT]
  [FONT=&quot]                    if (NS4) onresize = reDo;[/FONT]
  [FONT=&quot]                    if (IE4) onresize = reDoIE;[/FONT]
  
  [FONT=&quot]                    function reDoIE(){[/FONT]
  [FONT=&quot]                        imBG.width = document.body.clientWidth;[/FONT]
  [FONT=&quot]                        imBG.height = document.body.clientHeight;}[/FONT]
  [FONT=&quot]                    winWid = (NS4) ? innerWidth : document.body.clientWidth;[/FONT]
  [FONT=&quot]                    winHgt = (NS4) ? innerHeight : document.body.clientHeight;[/FONT]
  [FONT=&quot]                    imStr = "<div id=elBGim"[/FONT]
  [FONT=&quot]                        + " style='position:absolute;left:0;top:0;z-index:-1'>"[/FONT]
  [FONT=&quot]                        + "<img name='imBG' border='0' src="+imSRC;[/FONT]
  [FONT=&quot]                    if (scaleWidth) imStr += " width="+winWid;[/FONT]
  [FONT=&quot]                    if (scaleHeight) imStr += " height="+winHgt;[/FONT]
  [FONT=&quot]                    imStr += "></div>";[/FONT]
  [FONT=&quot]                    document.write(imStr);}[/FONT]
  [FONT=&quot]                makeIm();[/FONT]
  
  [FONT=&quot]        </script>[/FONT]
  [FONT=&quot]  </body>[/FONT]
  [FONT=&quot]</html>[/FONT]
 
Der Fehler ist, dass Du hier ein uraltes Script verwendest, welches noch Eigenschaften und Funktionen aus dem letzten Jahrtausend verwendet (NS4 und IE4 sagen wolh alles) und deshalb wohl nicht einheitlich funktioniert. Zudem ist es kein HTML was man da sieht sondern JavaScript, weshalb Du eigentlich das falsche Unterforum erwischt hast.

Was Du erreichen willst, lässt sich aber auch ohne diesen seltsam anmutenden Code erreichen. Mit CSS kannst Du auch ein Bild so strecken, dass es bestimmte Maße annimmt.

Code:
<img src="bild.jpg" alt="" style="width: 100%;height: 100%;" />
 
deine methode war mir bekannt streckt das bild aber nicht völlig es bleiben ca 5 px abstand zwischen der bildkante und der framekante ...
 
bei mir is aber komischerweiße immer noch ein kleiner abstand zwischen dem pic und dem rand vom frame
ka habs ohne frames probiert da funzt es aba mit frame halt ned und i brauchs daweil aber für frames :D
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html margin:0 padding:0>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="FFE500" margin:0 padding:0>
<img src="Pics/Index - Karte.jpg" alt="Karte" style="width: 100%;height: 100%;" border="0"/>
</body>
</html>
 
Zurück
Oben