Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [js/css] skrypt oswieza strone a nie powinien
right6
post
Post #1





Grupa: Zablokowani
Postów: 206
Pomógł: 0
Dołączył: 9.03.2006

Ostrzeżenie: (0%)
-----


Kod
<script type="text/javascript">

tab=[];
i=1;

while( tab.length<40 )
{
  tab.push(i);
  tab.push(i++);
}

for( i=0; i<40; i++ )
{
  document.write("<div id="+tab[i]+" style='float:left;background-color:red;width:30px;border:solid 1px black;' >"+tab[i]+"</div>");
  document.write("&nbsp;&nbsp;");
  if( i == 9 || i == 19 || i == 29 || i == 39 )
  {
    document.write("<br>");
  }
}

</script>


i problem pojawia sie gdy w stylach generowanego diva dalem border:solid 1px black. wszytsko sie rozjezdza. Natomias bez definicji border jest OK, div'y sa ladnie kolosiebie i pod soba

Ten post edytował right6 7.04.2006, 08:18:00
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
mike
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

Ostrzeżenie: (0%)
-----


O to chodziło:

Kod
<style type="text/css">
div.box {
    float:left;
    margin: 1px;
    width: 30px;
    height: 20px;
    border: #000 solid 1px;
    background: #efefef;
    text-align: center;
}

div.box:hover {
    border: #000080 solid 1px;
    background: #cdcdcd;
}

div#container {
    width: 340px;
    border: 0;
    background: #fff;
}
</style>

<div id="container">

<script type="text/javascript">

var k = 0;
for( var i=0; i < 40; i++ )
{
    k = k + 0.5;
    document.write( "<div id=\"box" + i + "\" class=\"box\">" + Math.ceil(k) + "</div>" );
}

</script>

</div>
(IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)
:?:
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.10.2025 - 21:43