Ciao a tutti ho un problema...
se creo una pagina con questo codice:
lo script contenuto funziona correttamente...codice:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> function ChangeCSSBgImg() { debugger; if (!document.getElementById) return false; var MyElement = "MyBody"; var ImgPath = "Img/"; var HomePage = "default.aspx"; if (!document.getElementById(MyElement)) return false; var random_images = new Array(); random_images[0] = "01.gif"; random_images[1] = "02.gif"; random_images[2] = "03.gif"; random_images[3] = "04.gif"; var $header = document.getElementById(MyElement); var $backgroundurl = $header.style.backgroundImage; var sPath = window.location.pathname; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); var ImgURL = ""; if (sPage.toLowerCase() == HomePage || sPage == "") { ImgURL = "none" } else { ImgURL = "url(" + ImgPath + random_images[rand(random_images.length)] + ")"; } if ($backgroundurl != ImgURL) { $header.style.backgroundImage = ImgURL; } movement = setTimeout("ChangeCSSBgImg()", 14000); } function rand(n) { return (Math.floor(Math.random() * n)); } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } addLoadEvent(ChangeCSSBgImg); </script> </head> <body id="MyBody"> </body> </html>
ma messo sul sito dove mi serve no...
qualcuno mi aiuta a capire perchč?
questo e' il sito
ps:lo script fā in modo che solo sulla home non copaia lo backgroud ... le altre randomico e ogni 14 secondi cambia..

Rispondi quotando

