Avatar billede PEBM Praktikant
30. april 2012 - 20:35 Der er 17 kommentarer og
1 løsning

Windows XP Kan eksperterne forklare mig(begynderen), hvorfor det kun er <body onload="changeImage1(false)">der vises ved opload. Image 2-9 bliver først synlige når jeg klikker på dem?Alle images er 4 billeder roteret 90

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML lang=en xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Katte_Puzzle</TITLE>



<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<STYLE>.drag {
    POSITION: relative; CURSOR: hand
}
.highlight {
    BACKGROUND: #ffff00; COLOR: #6600ff; CURSOR: hand
}
</STYLE>

<script type="text/javascript">
      function correctit(){
            return true
        }
        window.onerror=correctit
        var dragapproved=false
        var z,x,y
        function move(){
            if (event.button==1&&dragapproved){
                z.style.pixelLeft=temp1+event.clientX-x
                z.style.pixelTop=temp2+event.clientY-y
                return false
            }
        }
        function drags(){
            if (!document.all)
                return
            if (event.srcElement.className=="drag") {
                dragapproved=true
                z=event.srcElement
                temp1=z.style.pixelLeft
                temp2=z.style.pixelTop
                x=event.clientX
                y=event.clientY
                document.onmousemove=move
            }
        }
        document.onmousedown=drags
        document.onmouseup=new Function("dragapproved=false")"></SCRIPT>
<script type="text/javascript">
    //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage1(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage1");
           
            //set the Image1 location to a random Image1 from 0 to Image1Count
            img.src = "images/image1_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage1(true)", seconds * 1000);
            }
        }</SCRIPT>
<script type="text/javascript">
            //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage2(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage2");
           
            //set the image2 location to a random image2 from 0 to image2Count
            img.src = "images/image2_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage(true)", seconds * 1000);
            }
        }</SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate3.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate4.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate5.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate6.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate7.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate8.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate9.js"></SCRIPT>




<META name=GENERATOR content="MSHTML 8.00.6001.19222"></HEAD>
<body>
            <div align=CENTER><h1>Katte Sliding med rotation.</h1>
<table border="3" cellpadding="0" cellspacing="1" width="620"
bordercolor="#FF0000" height="620">

        <TBODY>
        <TR>
          <TD width="40%">
           
            <Div align="center">



<body onload="changeImage1(false)">
<img id="rotatingImage1" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage1(false);" />

<body onload="changeImage2(false)">
<img id="rotatingImage2" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage2(false);" />

<body onload="changeImage3(false)">
<img id="rotatingImage3" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage3(false);" /><br>

<body onload="changeImage4(false)">
<img id="rotatingImage4" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage4(false);" />

<body onload="changeImage5(false)">
<img id="rotatingImage5" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage5(false);" />

<body onload="changeImage6(false)">
<img id="rotatingImage6" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage6(false);" /><br>

<body onload="changeImage7(false)">
<img id="rotatingImage7" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage7(false);" />

<body onload="changeImage8(false)">
<img id="rotatingImage8" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage8(false);" />

<body onload="changeImage9(false)">
<img id="rotatingImage9" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage9(false);" />

</DIV>


</BODY></HTML>
Avatar billede tobrukDk Novice
30. april 2012 - 20:43 #1
Du skulle nok have lave den inde under JS..
Avatar billede moddi100 Seniormester
01. maj 2012 - 01:37 #2
<body> elementet er ment til kun at skulle fremkomme én gang på siden og det er lige efter </head>

Du har pt. elementet 10 gange og det er derfor du får fejl. I stedet kan du samle alle dine onload kald i én:


<body onload="start()">


Ovenstående kalder javascript funktionen start(), som du dog skal defineres. Det gøres oppe imellem de to <head> og </head> tags:

<head>
...
<script type="text/javascript">
function start()
{
changeImage1(false);
changeImage2(false);
changeImage3(false);
changeImage4(false);
changeImage5(false);
changeImage6(false);
changeImage7(false);
changeImage8(false);
changeImage9(false);

}
</script>
...
</head>
Avatar billede PEBM Praktikant
01. maj 2012 - 09:22 #3
Tak til moddi100
Ja det mener jeg også, har prøvet denne:
<SCRIPT language=JavaScript src="js/mymove.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate1.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate2.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate3.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate4.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate5.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate6.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate7.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate8.js"></SCRIPT>
<SCRIPT language=JavaScript src="js/myrotate9.js"></SCRIPT>


<script type="text/javascript">
function start()
{
changeImage1(false);
changeImage2(false);
changeImage3(false);
changeImage4(false);
changeImage5(false);
changeImage6(false);
changeImage7(false);
changeImage8(false);
changeImage9(false);

}
</script>

og denne

<script type="text/javascript">
function start()
{
changeImage1_0(false);
changeImage2_0(false);
changeImage3_0(false);
changeImage4_0(false);
changeImage5_0(false);
changeImage6_0(false);
changeImage7_0(false);
changeImage8_0(false);
changeImage9_0(false);

}
</script>
</HEAD>

Da mine billeder er Image1_0 - Image1_1 - Image1_2 - Image1_3
Image2_0 - Image2_1 etc.

men har slettet function start() scriptet igen, da det ikke ændrede noget.

I mit move script er der en fejl nederst:
document.onmouseup=new Function("dragapproved=false")"></SCRIPT>
skal være:
document.onmouseup=new Function("dragapproved=false")</SCRIPT>

PEBM
Avatar billede moddi100 Seniormester
01. maj 2012 - 09:42 #4
Prøv at indtaste din url på siden http://validator.w3.org og ret fejlene så godt du kan. Smid derefter et link herind, så vi kan hjælpe med resten.
Avatar billede PEBM Praktikant
01. maj 2012 - 11:16 #5
Nu har jeg prøvet http://validator.w3.org, det virker uoverskueligt. Har prøvet at rette nogle af de foreslåede fejl, men det hjælper ikke.
Kan jeg ikke sende en zippet fil af hele dokumentet med billeder til dig, så kan du jo også prøve at løse kattespillet - det virker?
Kan vi udveksle e-mail adresser på
"Intern Besked" ?
Avatar billede olsensweb.dk Ekspert
02. maj 2012 - 17:56 #6
må nok give #1 ret, det havde været bedre pladseret i JS gruppen.

#3 du har 2 functioner der hedder start, det må man ikke, functions overloadning er ikke tilladt i JS, ville iøvrigt også have krævet forskellige antal parameter

language=JavaScript, attributten language er forældet, brug type istedet

<SCRIPT language=JavaScript src="js/mymove.js"></SCRIPT>
rettes til
<script type="text/javascript" src="js/mymove.js"></script>

gør som der bliver skrevet i #4 Smid derefter et link herind, så vi måske kan hjælpe med resten., dette forudsat i ikke laver det uden om E
Avatar billede PEBM Praktikant
02. maj 2012 - 20:04 #7
Til ronols
Forslag #1
<SCRIPT language=JavaScript src="js/mymove.js"></SCRIPT>
rettes til
<script type="text/javascript" src="js/mymove.js"></script>
Ændrer ingenting
Forslag #3
Selvfølgelig har jeg ikke to start-funktioner, de to eksempler er dem jeg har prøvet-hver for sig.
Jeg mener det er rimelig let at hjælpe(hvis man kan)ved at kopiere mit dokument til en html-fil, og bruge tilfældige billeder.
Og så foreslå hvordan dokumentet skal se ud, i stedet for at skrive frem og tilbage om noget jeg ikke fatter.
Venlig hilsen PEBM
Avatar billede olsensweb.dk Ekspert
02. maj 2012 - 20:18 #8
da vi ikke ved hvormeget du har ændret/prøvet er det svært at hjælpe, da vi ikke kender den aktuelle code.
du skriver du har lavet ændringer for at rette nogle fejl der er fundet af http://validator.w3.org hvilke ??
der er ikke ret mange der gider paster hele coden ind, for at teste, og finde fejl.

læg et link til din side så kan vi se aktuelle code
Avatar billede PEBM Praktikant
02. maj 2012 - 21:19 #9
hej
Prøv denne side:http://www.eksperten.dk/spm/962169#reply_7939863
i http://validator.w3.org
Den viser 76 Errors, 38 warning(s) for mig virker det uoverskueligt.
Kan I derude rette alle fejl????
Det med at gide for at hjælpe ved jeg ikke hvad er-for hvis jeg ikke gider forsøger jeg ikke.
Forøvrigt Dokumentet #1 er rettet!
Avatar billede olsensweb.dk Ekspert
02. maj 2012 - 21:45 #10
det er jo ikke din code der bliver valideret, der eksperten's side der bliver valideret, alle indlæg vil af validatoren blive fortolket som tekst, og ikke som html code.

Forøvrigt Dokumentet #1 er rettet!
der menes vel #0 ??
hvad er det rettet til ??

skulle vi evt copiere din code for at afvikle den er vi også tvunget til at kende coden i myrotate.js til myrotate9.js
vi er nød til at se aktuelle code i rette sammenhæng

hvis du ikke lægger din side online kan jeg desværre ikke hjælpe
Avatar billede PEBM Praktikant
03. maj 2012 - 09:30 #11
Her er hele dokumentet med åbne scripts:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML lang=en xml:lang="en" xmlns="http://www.w3.org/TR/html4/loose.dtd"><HEAD>
<TITLE>Katte_Puzzle</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<STYLE>.drag {
    POSITION: relative; CURSOR: hand
}
.highlight {
    BACKGROUND: #ffff00; COLOR: #6600ff; CURSOR: hand
}
</STYLE>

<script type="text/javascript">
function correctit(){
  return true
  }
  window.onerror=correctit
  var dragapproved=false
  var z,x,y
  function move(){
  if (event.button==1&&dragapproved){
    z.style.pixelLeft=temp1+event.clientX-x
    z.style.pixelTop=temp2+event.clientY-y
    return false
  }
  }
  function drags(){
  if (!document.all)
    return
  if (event.srcElement.className=="drag") {
    dragapproved=true
    z=event.srcElement
    temp1=z.style.pixelLeft
    temp2=z.style.pixelTop
    x=event.clientX
    y=event.clientY
    document.onmousemove=move
  }
  }
  document.onmousedown=drags
  document.onmouseup=new Function("dragapproved=false")
</script>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage1(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage1");
           
            //set the Image1 location to a random Image1 from 0 to Image1Count
            img.src = "images/image1_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage1(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage2(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage2");
           
            //set the image2 location to a random image2 from 0 to image2Count
            img.src = "images/image2_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage(true)", seconds * 1000);
            }
        }

</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage3(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage3");
           
            //set the Image3 location to a random Image3 from 0 to Image3Count
            img.src = "images/Image3_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage3(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage4(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage4");
           
            //set the Image4 location to a random Image4 from 0 to Image4Count
            img.src = "images/Image4_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage4(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage5(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage5");
           
            //set the Image5 location to a random Image5 from 0 to Image5Count
            img.src = "images/Image5_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage5(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage6(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage6");
           
            //set the Image6 location to a random Image6 from 0 to Image6Count
            img.src = "images/Image6_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage6(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage7(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage7");
           
            //set the Image7 location to a random Image7 from 0 to Image7Count
            img.src = "images/Image7_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage7(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage8(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage8");
           
            //set the Image8 location to a random Image8 from 0 to Image8Count
            img.src = "images/Image8_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage8(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage9(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage9");
           
            //set the Image9 location to a random Image9 from 0 to Image9Count
            img.src = "images/Image9_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage9(true)", seconds * 1000);
            }
        }
</SCRIPT>


<script type="text/javascript">
function start()
{
changeImage1(false);
changeImage2(false);
changeImage3(false);
changeImage4(false);
changeImage5(false);
changeImage6(false);
changeImage7(false);
changeImage8(false);
changeImage9(false);

}
</script>

</HEAD>
<body>
<div align=CENTER>
<h1>Katte Sliding med rotation.</h1>

<table border="3" cellpadding="0" cellspacing="1" width="620"
bordercolor="#FF0000" height="620">
        <TBODY> 
          <TD width="100%">           
            <Div align="center">
<body onload="changeImage1(false)">
<img id="rotatingImage1" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage1(false);" />

<body onload="changeImage2(false)">
<img id="rotatingImage2" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage2(false);" />

<body onload="changeImage3(false)">
<img id="rotatingImage3" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage3(false);" /><br>

<body onload="changeImage4(false)">
<img id="rotatingImage4" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage4(false);" />

<body onload="changeImage5(false)">
<img id="rotatingImage5" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage5(false);" />

<body onload="changeImage6(false)">
<img id="rotatingImage6" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage6(false);" /><br>

<body onload="changeImage7(false)">
<img id="rotatingImage7" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage7(false);" />

<body onload="changeImage8(false)">
<img id="rotatingImage8" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage8(false);" />

<body onload="changeImage9(false)">
<img id="rotatingImage9" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage9(false);" />

</TBODY></TD></DIV></TABLE>


</BODY></HTML>


Jeg tror fejlen ligger i de 9 stk
<body onload="changeImage1(false)">
da det kun er billede 1 der vises!

For at få billed på:
Prøv tallene 1-9 og døb dem Image1_0,Image2_0,Image3_0 etc.
Dimension 200x200
Image1 = 4 billeder roteret 0, 90. 180, 270 grader
og kaldes Image1_0, Image1_1, Image1_2, Image1_3
samme for 2 - 9 image
Jeg kan sende billederne til din mail-adresse, hvis jeg får den.
Avatar billede PEBM Praktikant
03. maj 2012 - 14:06 #12
Min kommentar #11 er forsvundet, så her er den igen.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML lang=en xml:lang="en" xmlns="http://www.w3.org/TR/html4/loose.dtd"><HEAD>
<TITLE>Katte_Puzzle</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<STYLE>.drag {
    POSITION: relative; CURSOR: hand
}
.highlight {
    BACKGROUND: #ffff00; COLOR: #6600ff; CURSOR: hand
}
</STYLE>

<script type="text/javascript">
function correctit(){
  return true
  }
  window.onerror=correctit
  var dragapproved=false
  var z,x,y
  function move(){
  if (event.button==1&&dragapproved){
    z.style.pixelLeft=temp1+event.clientX-x
    z.style.pixelTop=temp2+event.clientY-y
    return false
  }
  }
  function drags(){
  if (!document.all)
    return
  if (event.srcElement.className=="drag") {
    dragapproved=true
    z=event.srcElement
    temp1=z.style.pixelLeft
    temp2=z.style.pixelTop
    x=event.clientX
    y=event.clientY
    document.onmousemove=move
  }
  }
  document.onmousedown=drags
  document.onmouseup=new Function("dragapproved=false")
</script>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage1(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage1");
           
            //set the Image1 location to a random Image1 from 0 to Image1Count
            img.src = "images/image1_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage1(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage2(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage2");
           
            //set the image2 location to a random image2 from 0 to image2Count
            img.src = "images/image2_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage(true)", seconds * 1000);
            }
        }

</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage3(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage3");
           
            //set the Image3 location to a random Image3 from 0 to Image3Count
            img.src = "images/Image3_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage3(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage4(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage4");
           
            //set the Image4 location to a random Image4 from 0 to Image4Count
            img.src = "images/Image4_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage4(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage5(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage5");
           
            //set the Image5 location to a random Image5 from 0 to Image5Count
            img.src = "images/Image5_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage5(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage6(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage6");
           
            //set the Image6 location to a random Image6 from 0 to Image6Count
            img.src = "images/Image6_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage6(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage7(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage7");
           
            //set the Image7 location to a random Image7 from 0 to Image7Count
            img.src = "images/Image7_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage7(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage8(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage8");
           
            //set the Image8 location to a random Image8 from 0 to Image8Count
            img.src = "images/Image8_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage8(true)", seconds * 1000);
            }
        }
</SCRIPT>

<script type="text/javascript">        //declare variables
        var imageCount = 4;
        var seconds = 1;
       
        function changeImage9(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage9");
           
            //set the Image9 location to a random Image9 from 0 to Image9Count
            img.src = "images/Image9_" + parseInt(Math.random()*imageCount) + ".jpg";
           
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage9(true)", seconds * 1000);
            }
        }
</SCRIPT>


<script type="text/javascript">
function start()
{
changeImage1(false);
changeImage2(false);
changeImage3(false);
changeImage4(false);
changeImage5(false);
changeImage6(false);
changeImage7(false);
changeImage8(false);
changeImage9(false);

}
</script>

</HEAD>
<body>
<div align=CENTER>
<h1>Katte Sliding med rotation.</h1>

<table border="3" cellpadding="0" cellspacing="1" width="620"
bordercolor="#FF0000" height="620">
        <TBODY> 
          <TD width="100%">           
            <Div align="center">
<body onload="changeImage1(false)">
<img id="rotatingImage1" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage1(false);" />

<body onload="changeImage2(false)">
<img id="rotatingImage2" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage2(false);" />

<body onload="changeImage3(false)">
<img id="rotatingImage3" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage3(false);" /><br>

<body onload="changeImage4(false)">
<img id="rotatingImage4" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage4(false);" />

<body onload="changeImage5(false)">
<img id="rotatingImage5" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage5(false);" />

<body onload="changeImage6(false)">
<img id="rotatingImage6" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage6(false);" /><br>

<body onload="changeImage7(false)">
<img id="rotatingImage7" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage7(false);" />

<body onload="changeImage8(false)">
<img id="rotatingImage8" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage8(false);" />

<body onload="changeImage9(false)">
<img id="rotatingImage9" name="image" src="" width="200" height="200" 
style="FILTER: " id=myfilter class=drag onclick="changeImage9(false);" />

</TBODY></TD></DIV></TABLE>


</BODY></HTML>


Jeg tror fejlen ligger i de 9 stk
<body onload="changeImage1(false)">
da det kun er billede 1 der vises!

For at få billed på:
Prøv tallene 1-9 og døb dem Image1_0,Image2_0,Image3_0 etc.
Dimension 200x200
Image1 = 4 billeder roteret 0, 90. 180, 270 grader
og kaldes Image1_0, Image1_1, Image1_2, Image1_3
samme for 2 - 9 image
Jeg kan sende billederne til din mail-adresse, hvis jeg får den.
Avatar billede olsensweb.dk Ekspert
03. maj 2012 - 17:43 #13
en hurtig omskrivning af din code er nedenfor, jeg har valgt ikke at bruge tabel til design da man er gået bor fra dette for mere end 10 år siden
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title></title>
    <style type="text/css">
    .drag {
        POSITION: relative; CURSOR: hand
    }
    .highlight {
        BACKGROUND: #ffff00; COLOR: #6600ff; CURSOR: hand
    }
    .RotImg{
        width: 200px;
        height: 200px;
    }
    .txtcenter{
        text-align: center;
    }
    </style>
    <script type="text/javascript">
    function correctit(){
  return true
  }
  window.onerror=correctit
  var dragapproved=false
  var z,x,y
  function move(){
  if (event.button==1&&dragapproved){
    z.style.pixelLeft=temp1+event.clientX-x
    z.style.pixelTop=temp2+event.clientY-y
    return false
  }
  }
  function drags(){
  if (!document.all)
    return
  if (event.srcElement.className=="drag") {
    dragapproved=true
    z=event.srcElement
    temp1=z.style.pixelLeft
    temp2=z.style.pixelTop
    x=event.clientX
    y=event.clientY
    document.onmousemove=move
  }
  }
  document.onmousedown=drags
  document.onmouseup=new Function("dragapproved=false")
  //declare variables
        var imageCount = 4;
        var seconds = 1;
        function changeImage1(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage1");
         
            //set the Image1 location to a random Image1 from 0 to Image1Count
            img.src = "images/image1_" + parseInt(Math.random()*imageCount) + ".jpg";
         
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage1(true)", seconds * 1000);
            }
        }
//declare variables
        var imageCount = 4;
        var seconds = 1;
        function changeImage2(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage2");
         
            //set the image2 location to a random image2 from 0 to image2Count
            img.src = "images/image2_" + parseInt(Math.random()*imageCount) + ".jpg";
         
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage(true)", seconds * 1000);
            }
        }   
    //declare variables
        var imageCount = 4;
        var seconds = 1;     
        function changeImage3(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage3");
         
            //set the Image3 location to a random Image3 from 0 to Image3Count
            img.src = "images/Image3_" + parseInt(Math.random()*imageCount) + ".jpg";
         
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage3(true)", seconds * 1000);
            }
        }
//declare variables
        var imageCount = 4;
        var seconds = 1;
     
        function changeImage4(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage4");
         
            //set the Image4 location to a random Image4 from 0 to Image4Count
            img.src = "images/Image4_" + parseInt(Math.random()*imageCount) + ".jpg";
         
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage4(true)", seconds * 1000);
            }
        }
//declare variables
        var imageCount = 4;
        var seconds = 1;
     
        function changeImage5(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage5");
         
            //set the Image5 location to a random Image5 from 0 to Image5Count
            img.src = "images/Image5_" + parseInt(Math.random()*imageCount) + ".jpg";
         
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage5(true)", seconds * 1000);
            }
        }
//declare variables
        var imageCount = 4;
        var seconds = 1;
     
        function changeImage6(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage6");
         
            //set the Image6 location to a random Image6 from 0 to Image6Count
            img.src = "images/Image6_" + parseInt(Math.random()*imageCount) + ".jpg";
         
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage6(true)", seconds * 1000);
            }
        }
//declare variables
        var imageCount = 4;
        var seconds = 1;
     
        function changeImage7(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage7");
         
            //set the Image7 location to a random Image7 from 0 to Image7Count
            img.src = "images/Image7_" + parseInt(Math.random()*imageCount) + ".jpg";
         
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage7(true)", seconds * 1000);
            }
        }
//declare variables
        var imageCount = 4;
        var seconds = 1;
     
        function changeImage8(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage8");
         
            //set the Image8 location to a random Image8 from 0 to Image8Count
            img.src = "images/Image8_" + parseInt(Math.random()*imageCount) + ".jpg";
         
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage8(true)", seconds * 1000);
            }
        }
//declare variables
        var imageCount = 4;
        var seconds = 1;
     
        function changeImage9(createLoop){
            //get the element
            var img = document.getElementById("rotatingImage9");
         
            //set the Image9 location to a random Image9 from 0 to Image9Count
            img.src = "images/Image9_" + parseInt(Math.random()*imageCount) + ".jpg";
         
            //setTimeout call function at time from now in MS
            if(createLoop){
                setTimeout("changeImage9(true)", seconds * 1000);
            }
        }

function start(){
    changeImage1(false);
    changeImage2(false);
    changeImage3(false);
    changeImage4(false);
    changeImage5(false);
    changeImage6(false);
    changeImage7(false);
    changeImage8(false);
    changeImage9(false);
}       
</script>
</head>
<body onload="start()">
<div class="txtcenter">
    <h1>Katte Sliding med rotation.</h1>
    <img id="rotatingImage1" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage1(false);" />
    <img id="rotatingImage2" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage2(false);" />
    <img id="rotatingImage3" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage3(false);" /><br>
    <img id="rotatingImage4" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage4(false);" />
    <img id="rotatingImage5" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage5(false);" />
    <img id="rotatingImage6" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage6(false);" /><br>
    <img id="rotatingImage7" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage7(false);" />
    <img id="rotatingImage8" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage8(false);" />
    <img id="rotatingImage9" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage9(false);" />
</div>
</body>
</html>
Avatar billede olsensweb.dk Ekspert
03. maj 2012 - 17:44 #14
som du kan se er functionerne changeImage1 til changeImage9 næsten helt ens, det eneste der ændres er nummer, så man kan sammenlægge disse og everfører en parameter der angiver hvilke img mna har fat i
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title></title>
    <style type="text/css">
    .drag {
        POSITION: relative; CURSOR: hand
    }
    .highlight {
        BACKGROUND: #ffff00; COLOR: #6600ff; CURSOR: hand
    }   
    .RotImg{
        width: 200px;
        height: 200px;
    }   
    .txtcenter{
        text-align: center;
    }   
    </style>
    <script type="text/javascript">
    function correctit(){
        return true;
    }
    window.onerror=correctit;
    var dragapproved=false;
    var z,x,y;
    function move(){
        if (event.button==1&&dragapproved){
            z.style.pixelLeft=temp1+event.clientX-x;
            z.style.pixelTop=temp2+event.clientY-y;
            return false;
        }
    }
    function drags(){
        if (!document.all) return;
        if (event.srcElement.className=="drag") {
            dragapproved=true;
            z=event.srcElement;
            temp1=z.style.pixelLeft;
            temp2=z.style.pixelTop;
            x=event.clientX;
            y=event.clientY;
            document.onmousemove=move;
        }
    }
    document.onmousedown=drags;
    document.onmouseup=new Function("dragapproved=false");
 
    function changeImage(createLoop, no){
        var imageCount = 4;
        var seconds = 1;
        //get the element       
        var img = document.getElementById("rotatingImage"+no);
         
        //set the Image1 location to a random Image1 from 0 to Image1Count
        img.src = "images/image"+no+"_" + parseInt(Math.random()*imageCount) + ".jpg";
         
        //setTimeout call function at time from now in MS
        if(createLoop){
            setTimeout("changeImage"+no+"(true)", seconds * 1000);
        }
    }

    function start(){
        for(i=1;i<10;i++){
            changeImage(false,i);
        }
    }   
/*   
    function start(){
        changeImage(false,1);
        changeImage(false,2);
        changeImage(false,3);
        changeImage(false,4);
        changeImage(false,5);
        changeImage(false,6);
        changeImage(false,7);
        changeImage(false,8);
        changeImage(false,9);
    }
*/   
    </script>
</head>
<body onload="start()">
<div class="txtcenter">
<h1>Katte Sliding med rotation.</h1>
    <img id="rotatingImage1" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage(false,1);" />
    <img id="rotatingImage2" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage(false,2);" />
    <img id="rotatingImage3" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage(false,3);" /><br>
    <img id="rotatingImage4" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage(false,4);" />
    <img id="rotatingImage5" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage(false,5);" />
    <img id="rotatingImage6" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage(false,6);" /><br>
    <img id="rotatingImage7" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage(false,7);" />
    <img id="rotatingImage8" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage(false,8);" />
    <img id="rotatingImage9" alt="image"  src="empty.jpg" class="RotImg drag" onclick="changeImage(false,9);" />
</div>
</body>
</html>
Avatar billede PEBM Praktikant
03. maj 2012 - 18:42 #15
Tusind tak til ronols, nu virker det perfekt.
Venlig hilsen PEBM
Avatar billede PEBM Praktikant
03. maj 2012 - 20:15 #16
Ja hej igen ronols min "function move" er gået tabt, kan ikke se hvor.
Kan du hjælpe igen?
Avatar billede olsensweb.dk Ekspert
03. maj 2012 - 21:30 #17
et hurtigt bud!!
du har ikke includeret denne linje
<script type="text/javascript" src="js/mymove.js"></script>
vist i #3
med mindre mymove.js skulle indeholde
function correctit(){
    return true
}
window.onerror=correctit
var dragapproved=false
var z,x,y
function move(){
    if (event.button==1&&dragapproved){
        z.style.pixelLeft=temp1+event.clientX-x
        z.style.pixelTop=temp2+event.clientY-y
        return false
    }
}
function drags(){
    if (!document.all)
        return
    if (event.srcElement.className=="drag") {
        dragapproved=true
        z=event.srcElement
        temp1=z.style.pixelLeft
        temp2=z.style.pixelTop
        x=event.clientX
        y=event.clientY
        document.onmousemove=move
    }
}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")


men dette vist i #0
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")"> </SCRIPT>
er der fejl i. (fejl markeret med rødt)
du havde muligvis noget code før dette, jeg har bare fjernet ">

ellers har jeg ikke noget umildbart bud, du må tilbage og finde org coden og sammenligne, du skrev du havde noget der virkede i #5
[i]så kan du jo også prøve at løse kattespillet - det virker?[i]
Avatar billede PEBM Praktikant
04. maj 2012 - 10:23 #18
Jeg har fundet fejlen

class="RotImg drag" onclick="changeImage

rettes til

class=drag onclick="changeImage

PEBM
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester