Onmouseover, eine Art Rubbellos

  • Okay, leider funkioniert das nicht, auch nicht mit deinem Originalcode :( Also das mit dem alert...


  • http://test.kkw-forum.de/rubbel.php

  • <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>

    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
    <title>putzen</title>
    <style type="text/css">
    #bildlayer{

    }
    #rubbelbilder{
    height:150px;
    width:150px;
    }

    .grey1{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d1.png);
    width:150px;
    height:150px;

    float:left;
    }
    .grey2{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d2.png);
    width:150px;
    height:150px;

    float:left;
    }
    .grey3{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d3.png);
    width:150px;
    height:150px;

    float:left;
    }
    .grey4{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d4.png);
    width:150px;
    height:150px;

    float:left;
    }
    .grey5{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d5.png);
    width:150px;
    height:150px;

    float:left;
    }
    .grey6{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d6.png);
    width:150px;
    height:150px;

    float:left;
    }
    .grey7{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d7.png);
    width:150px;
    height:150px;

    float:left;
    }
    .grey8{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d8.png);
    width:150px;
    height:150px;

    float:left;
    }
    .grey9{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d9.png);
    width:150px;
    height:150px;

    float:left;
    }
    .grey10{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d10.png);
    width:150px;
    height:150px;

    float:left;
    }
    .grey11{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d11.png);
    width:150px;
    height:150px;

    float:left;
    }
    .grey12{
    background-image: url(http://gutfalkenstein.bplaced.net/test/dreckig/d12.png);
    width:150px;
    height:150px;

    float:left;
    }

    .weg{
    background:transparent;
    width:150px;
    height:150px;
    display:inline;
    float:left;
    }
    </style>
    <script type="text/javascript">
    var durch = false;
    function machweg(obj){
    document.getElementById(obj).className="weg";
    checkThem();
    }
    function writePic1(){
    document.getElementById("bildlayer").style.background = "url(sauber/s1.png)";
    }
    function writePic2(){
    document.getElementById("bildlayer2").style.background = "url(sauber/s2.png)";
    }
    function writePic3(){
    document.getElementById("bildlayer3").style.background = "url(sauber/s3.png)";
    }
    function writePic4(){
    document.getElementById("bildlayer4").style.background = "url(sauber/s4.png)";
    }
    function writePic5(){
    document.getElementById("bildlayer5").style.background = "url(sauber/s5.png)";
    }
    function writePic6(){
    document.getElementById("bildlayer6").style.background = "url(sauber/s6.png)";
    }
    function writePic7(){
    document.getElementById("bildlayer7").style.background = "url(sauber/s7.png)";
    }
    function writePic8(){
    document.getElementById("bildlayer8").style.background = "url(sauber/s8.png)";
    }
    function writePic9(){
    document.getElementById("bildlayer9").style.background = "url(sauber/s9.png)";
    }
    function writePic10(){
    document.getElementById("bildlayer10").style.background = "url(sauber/s10.png)";
    }
    function writePic11(){
    document.getElementById("bildlayer11").style.background = "url(sauber/s11.png)";
    }
    function writePic12(){
    document.getElementById("bildlayer12").style.background = "url(sauber/s12.png)";
    }
    function checkThem(){
    var divcount=1;
    var alledivs = document.getElementsByTagName("div");

    for(i=0; i< (alledivs.length-1); i++){
    if(alledivs[i].className=="weg"){
    divcount++;
    }
    }
    if(divcount== (alledivs.length-1)){
    document.getElementById("ausgabe").innerHTML="Du bis durch...!"
    }
    }
    </script>


    </head>
    <body>

    <table style="width: 600px;" border="0" cellpadding="0" cellspacing="0">

    <tbody>

    <tr>

    <td style="width: 150px;">


    <div id="bildlayer">
    <?php
    $gesamt = (150/150)*(150/150);
    for($i=0; $i < $gesamt; $i++){
    echo "<div id=\"".$i."\" class=\"grey1\" onmouseover=\"machweg(".$i.");\"></div>";
    }
    ?>

    <br style="clear:both;" />
    <script type="text/javascript">
    writePic1();
    </script>


    </td>

    <td style="width: 150px;">


    <div id="bildlayer2">
    <?php
    $gesamt = (150/150)*(150/150);
    for($i=0; $i < $gesamt; $i++){
    echo "<div id=\"".$i."\" class=\"grey2\" onmouseover=\"machweg(".$i.");\"></div>";
    }
    ?>

    <br style="clear:both;" />
    <script type="text/javascript">
    writePic2();
    </script>


    </td>
    <td>

    <div id="bildlayer3">
    <?php
    $gesamt = (150/150)*(150/150);
    for($i=0; $i < $gesamt; $i++){
    echo "<div id=\"".$i."\" class=\"grey3\" onmouseover=\"machweg(".$i.");\"></div>";
    }
    ?>

    <br style="clear:both;" />
    <script type="text/javascript">
    writePic3();
    </script>


    </td>
    <td style="width: 150px;">


    <div id="bildlayer4">
    <?php
    $gesamt = (150/150)*(150/150);
    for($i=0; $i < $gesamt; $i++){
    echo "<div id=\"".$i."\" class=\"grey4\" onmouseover=\"machweg(".$i.");\"></div>";
    }
    ?>

    <br style="clear:both;" />
    <script type="text/javascript">
    writePic4();
    </script>


    </td>

    </tr>
    <tr>
    <td>


    <div id="bildlayer5">
    <?php
    $gesamt = (150/150)*(150/150);
    for($i=0; $i < $gesamt; $i++){
    echo "<div id=\"".$i."\" class=\"grey5\" onmouseover=\"machweg(".$i.");\"></div>";
    }
    ?>

    <br style="clear:both;" />
    <script type="text/javascript">
    writePic5();
    </script>


    </td>
    <td>


    <div id="bildlayer6">
    <?php
    $gesamt = (150/150)*(150/150);
    for($a=0; $a < $gesamt; $a++){
    echo "<div id=\"".$a."\" class=\"grey6\" onmouseover=\"machweg(".$i.");\"></div>";
    }
    ?>

    <br style="clear:both;" />
    <script type="text/javascript">
    writePic6();
    </script>


    </td>
    <td>


    <div id="bildlayer7">
    <?php
    $gesamt = (150/150)*(150/150);
    for($i=0; $i < $gesamt; $i++){
    echo "<div id=\"".$i."\" class=\"grey7\" onmouseover=\"machweg(".$i.");\"></div>";
    }
    ?>

    <br style="clear:both;" />
    <script type="text/javascript">
    writePic7();
    </script>


    </td>
    <td><img style="width: 150px; height: 150px;" alt="" src="sauber/s8.png"></td>
    </tr>
    <tr>
    <td><img style="width: 150px; height: 150px;" alt="" src="sauber/s9.png"></td>
    <td><img style="width: 150px; height: 150px;" alt="" src="sauber/s10.png"></td>
    <td><img style="width: 150px; height: 150px;" alt="" src="sauber/s11.png"></td>
    <td><img style="width: 150px; height: 150px;" alt="" src="sauber/s12.png"></td>
    </tr>

    </tbody>
    </table>
    <br>
    <span id="ausgabe"></span>
    </body>
    </html>


    Mein Code.. Warum wird immer nur dieses d1.png zu s1.png???? Wenn ich über d2.png fahre, möchte ich auch das es zu s2.png wird..