Hjælp!!

Tags:    php

Hej alle hvorfor virker denne kode ikke i IE.


echo "<script type=\"text/javascript\">\n";
echo "/******************************************\n";
code\n";
echo "* Last updated Nov 9th, 05\' by DD. This notice must stay intact for use\n";
echo "******************************************/\n";
echo " \n";
echo " //Configure below to change URL path to the snow image\n";
echo " var snowsrc=\"STI TIL BILLEDE"\n";
echo " // Configure below to change number of snow to render\n";
echo " var no = 10;\n";
echo " // Configure whether snow should disappear after x seconds (0=never):\n";
echo " var hidesnowtime = 0;\n";
echo " // Configure how much snow should drop down before fading (\"windowheight\" or \"pageheight\")\n";
echo " var snowdistance = \"pageheight\";\n";
echo "///////////Stop Config//////////////////////////////////\n";
echo " var ie4up = (document.all) ? 1 : 0;\n";
echo " var ns6up = (document.getElementById&&!document.all) ? 1 : 0;\n";
echo " function iecompattest(){\n";
echo " return (document.compatMode && document.compatMode!=\"BackCompat\")? document.documentElement : document.body\n";
echo " }\n";
echo " var dx, xp, yp; // coordinate and position variables\n";
echo " var am, stx, sty; // amplitude and step variables\n";
echo " var i, doc_width = 800, doc_height = 600; \n";
echo " \n";
echo " if (ns6up) {\n";
echo " doc_width = self.innerWidth;\n";
echo " doc_height = self.innerHeight;\n";
echo " } else if (ie4up) {\n";
echo " doc_width = iecompattest().clientWidth;\n";
echo " doc_height = iecompattest().clientHeight;\n";
echo " }\n";
echo " dx = new Array();\n";
echo " xp = new Array();\n";
echo " yp = new Array();\n";
echo " am = new Array();\n";
echo " stx = new Array();\n";
echo " sty = new Array();\n";
echo " snowsrc=(snowsrc.indexOf(\"dynamicdrive.com\")!=-1)? \"snow.gif\" : snowsrc\n";
echo " for (i = 0; i < no; ++ i) { \n";
echo " dx = 0; // set coordinate variables\n";
echo " xp = Math.random()*(doc_width-50); // set position variables\n";
echo " yp = Math.random()*doc_height;\n";
echo " am = Math.random()*20; // set amplitude variables\n";
echo " stx = 0.02 + Math.random()/10; // set step variables\n";
echo " sty = 0.7 + Math.random(); // set step variables\n";
echo " if (ie4up||ns6up) {\n";
echo " if (i == 0) {\n";
echo " document.write(\"<div id=\\\"dot\"+ i +\"\\\" style=\\\"POSITION: absolute; Z-INDEX: \"+ i +\"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\\\"><a href=\\\"http://dynamicdrive.com\\\"><img src=\'\"+snowsrc+\"\' border=\\\"0\\\"><\\/a><\\/div>\");\n";
echo " } else {\n";
echo " document.write(\"<div id=\\\"dot\"+ i +\"\\\" style=\\\"POSITION: absolute; Z-INDEX: \"+ i +\"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\\\"><img src=\'\"+snowsrc+\"\' border=\\\"0\\\"><\\/div>\");\n";
echo " }\n";
echo " }\n";
echo " }\n";
echo " function snowIE_NS6() { // IE and NS6 main animation function\n";
echo " doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;\n";
echo " doc_height=(window.innerHeight && snowdistance==\"windowheight\")? window.innerHeight : (ie4up && snowdistance==\"windowheight\")? iecompattest().clientHeight : ((!e && !window.opera && snowdistance==\"pageheight\")? iecompattest().scrollHeight : iecompattest().offsetHeight;\n";
echo " for (i = 0; i < no; ++ i) { // iterate for every dot\n";
echo " yp += sty;\n";
echo " if (yp > doc_height-50) {\n";
echo " xp = Math.random()*(doc_width-am-30);\n";
echo " yp = 0;\n";
echo " stx = 0.02 + Math.random()/10;\n";
echo " sty = 0.7 + Math.random();\n";
echo " }\n";
echo " dx += stx;\n";
echo " document.getElementById(\"dot\"+i).style.top=yp+\"px\";\n";
echo " document.getElementById(\"dot\"+i).style.left=xp + am*Math.sin(dx)+\"px\"; \n";
echo " }\n";
echo " snowtimer=setTimeout(\"snowIE_NS6()\", 10);\n";
echo " }\n";
echo " function hidesnow(){\n";
echo " if (window.snowtimer) clearTimeout(snowtimer)\n";
echo " for (i=0; i<no; i++) document.getElementById(\"dot\"+i).style.visibility=\"hidden\"\n";
echo " }\n";
echo " \n";
echo "if (ie4up||ns6up){\n";
echo " snowIE_NS6();\n";
echo " if (hidesnowtime>0)\n";
echo " setTimeout(\"hidesnow()\", hidesnowtime*1000)\n";
echo " }\n";
echo "</script>\n";




5 svar postet i denne tråd vises herunder
2 indlæg har modtaget i alt 4 karma
Sorter efter stemmer Sorter efter dato
Lav emnet med en relevant overskrift!



Vil også lige tilføje at det ikke hjælper så forfærdeligt meget at poste i PHP-forummet, hvis du er ude efter at finde ud af hvorfor den ikke fungerer i IE, det lyder mere som et css spørgsmål :) PHP fungerer ens i ALLE browsere!! Men den HTML kode som bliver genereret af PHP'en kan dog blive fortolket forskelligt i de forskellige browsere.



Du burde formentlig have postet det her i Javascript-kategorien i stedet, da det jo er javascript. Ser heller ikke nogen fordel ved at lave en echo for hver linje af dit javascript, spild af tid, og det gør din kode uoverskuelig.





Oaky det med echo er noget denne converter http://tools.devshed.com/webmaster-tools/html2php/ selv har lavet da jeg ikke selv ville til at skrive de om til php



Den kode du viser forudsat at det ikke er udvikleren der retter den, virker hverken i firefox eller IE, da selve PHP koden er fuld af fejl.

Det kunne selvfølgelig være at de faktisk mener HTML når de skriver HTML.
echo "/******************************************\n";
code\n";
echo "* Last updated Nov 9th, 05\' by DD. This notice must stay intact for use\n";
echo "******************************************/\n";
echo " \n";
echo " //Configure below to change URL path to the snow image\n";
echo " var snowsrc=\"STI TIL BILLEDE"\n";

de stedet jeg lige kunne finde markeret med bold, der er andre steder, men de kunne forklares af udviklerens linie brud.





Indlæg senest redigeret d. 05.11.2009 19:46 af Bruger #5620
t