Ich habe in folgendem HTML file den Bug, das ich statt einem 2 Wallpaper habe.
Bloß wie bekomme ich das rechte weg????
Alles anzeigen
Bloß wie bekomme ich das rechte weg????
HTML-Quellcode
- <html>
- <head><title>newclock</title></head>
- <style>
- SPAN#clock
- {
- font-family: Helvetica;
- font-weight: ;
- color: white;
- font-size: 35px;
- text-shadow: #000000 1px 2px 1px;
- }
- SPAN#ampm
- {
- font-family: Helvetica;
- color: #transparent;
- font-size: 15px;
- text-shadow: #000000 1px 2px 1px;
- }
- SPAN#calendar
- {
- font-family: Helvetica;
- font-weight: ;
- text-align: center;
- color: white;
- text-shadow: #000000 1px 2px 1px;
- }
- </style>
- <script type="text/javascript">
- function init ( )
- {
- timeDisplay = document.createTextNode ( "" );
- document.getElementById("clock").appendChild ( timeDisplay );
- }
- function updateClock ( )
- {
- var currentTime = new Date ( );
- var currentHours = currentTime.getHours ( );
- var currentMinutes = currentTime.getMinutes ( );
- var currentSeconds = currentTime.getSeconds ( );
- // Pad the minutes and seconds with leading zeros, if required
- currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
- currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
- // Choose either "AM" or "PM" as appropriate
- var timeOfDay = ( currentHours < 24 ) ? "AM" : "PM";
- // Convert the hours component to 24-hour format if needed
- currentHours = ( currentHours > 24 ) ? currentHours - 24 : currentHours;
- // Convert an hours component of "0" to "24"
- currentHours = ( currentHours == 24 ) ? 0 : currentHours;
- // Compose the string for display
- var currentTimeString = currentHours + ":" + currentMinutes;
- // Update the time display
- document.getElementById("clock").firstChild.nodeValue = currentTimeString;
- }
- function init2 ( )
- {
- timeDisplay = document.createTextNode ( "" );
- document.getElementById("ampm").appendChild ( timeDisplay );
- }
- function amPm ( )
- {
- var currentTime = new Date ( );
- var currentHours = currentTime.getHours ( );
- // Choose either "AM" or "PM" as appropriate
- var timeOfDay = ( currentHours < 24 ) ? "" : "";
- // Convert the hours component to 24-hour format if needed
- currentHours = ( currentHours > 24 ) ? currentHours - 24 : currentHours;
- // Convert an hours component of "0" to "24"
- currentHours = ( currentHours == 24 ) ? 0 : currentHours;
- // Compose the string for display
- var currentTimeString = timeOfDay;
- // Update the time display
- document.getElementById("ampm").firstChild.nodeValue = currentTimeString;
- }
- function init3 ( )
- {
- timeDisplay = document.createTextNode ( "" );
- document.getElementById("calendar").appendChild ( timeDisplay );
- }
- function calendarDate ( )
- {
- var this_weekday_name_array = new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag")
- var this_month_name_array = new Array("Januar","Februar","MŠrz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember") //predefine month names
- var this_date_timestamp = new Date()
- var this_weekday = this_date_timestamp.getDay()
- var this_date = this_date_timestamp.getDate()
- var this_month = this_date_timestamp.getMonth()
- var this_year = this_date_timestamp.getYear()
- if (this_year < 1000)
- this_year+= 1900;
- if (this_year==101)
- this_year=2001;
- document.getElementById("calendar").firstChild.nodeValue = this_weekday_name_array[this_weekday] + ", " + this_date + ". " + this_month_name_array[this_month] + " " + this_year //concat long date string
- }
- </script>
- </head>
- </style>
- </head>
- <body>
- <img id="img1" class="fade-in">
- <img id="img2" class="fade-out">
- <script>
- // By Mk321024 <mk321024@yahoo.com>
- var interval = 15; // Seconds between change (must be > duration)
- var imageDir = "./Wallpapers/";
- var duration = 3;
- var images = [
- "1.png",
- "2.png",
- "3png",
- "4.png",
- "5.png",
- "6.png",
- "7.png",
- "8.png",
- "9.png",
- "10.png",
- "11.png",
- "12.png",
- "13.png",
- "14.png",
- ];
- //// Hier musst man nichts mehr ändern :) ////
- var index = 0;
- var imageCount = images.length;
- var randomize = function(){
- return Math.round(5 - 10 * Math.random());
- };
- var fade = function(){
- img1.style.zIndex = 1;
- img2.style.zIndex = 2;
- img1.className = "fade-in";
- img2.className = "fade-out";
- index = (index + 1) % imageCount;
- if(!index){
- images.sort(randomize);
- }
- var tmp = img1;
- img1 = img2;
- img2 = tmp;
- setTimeout(function(){img1.src = imageDir + images[index];}, duration * 1000);
- setTimeout(fade, interval * 1000);
- };
- images.sort(randomize);
- img1.src = imageDir + images[index];
- fade();
- </script>
- <table style="position: absolute; top: 0px; left: 0px; width: 320px; height: 130px;" cellspacing="0" cellpadding="0" align="center">
- <tr align="center" valign="top" border="0" cellpadding="0">
- <td width="320" height="130" background="ClockBar.png" valign="top">
- </td>
- </tr>
- </table>
- <table style="position: absolute; top: 32px; left: 0px; width: 320px; height: 461px;" cellspacing="0" cellpadding="0" align="center">
- <tr align="center" valign="top" border="0" cellpadding="0">
- <td height="10" valign="top">
- <span id="clock">
- <script language="JavaScript">updateClock(); setInterval('updateClock()', 1000 )</script></span><span id="ampm">
- <script language="JavaScript">amPm(); setInterval('amPm()', 1000 )</script>
- </span>
- </td>
- </tr>
- <tr align="center">
- <td id="date" valign="top" halign="center">
- <span id="calendar">
- <script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script>
- </span>
- </td>
- </tr>
- </table>
- </body>
- </html>