我是一個新手,並且我不瞭解JavaScript的很多內容。我所知道的是Safari和Explorer中的以下頁面/代碼加載,而不是Chrome或Firefox。任何人都可以指向任何缺少的代碼或特定的錯誤?非常感激。下面是實際的頁面:https://dl.dropboxusercontent.com/u/9832487/Timeline/timeline2.htmlJavascript不能在Chrome或Firefox中使用
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link REL="SHORTCUT ICON" HREF="UVALogo.ico">
<title>SS Timeline Tool</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<style type="text/css">
body { font-family:Verdana,Geneva,sans-serif; font-size:xx-small; }
.rounded-corners { -moz-border-radius:8px;-webkit-border-radius:8px;-khtml-border-radius:8px;border-radius:8px;}
.shadedback { background-color:#eee;border-radius:8px;
background:-moz-linear-gradient(top,#f0f0f0,#dfdfdf);
background:-webkit-linear-gradient(top, #f0f0f0 0%, #dfdfdf 100%);
border-collapse: collapse;
}
</style>
</head>
<body>
<div id="surfaceDiv" style="position:absolute;left:29%;width:68%;padding:1%" class="rounded-corners"></div>
<div id="picBinDiv" style="position:absolute;left:1%;width:25%;padding:1%" class="shadedback"></div>
</body>
</html>
<script>
// SETUP
var picWidth=0; // Width of pics (use 0 to disable)
var picHeight=96; // Height of pics(use 0 to disable)
var backPic="background.jpg"; // URL to back surface picture (if any)
var pics=["https://dl.dropboxusercontent.com/u/9832487/Timeline/Images/cch.jpg", // Each entry in array is a pic
];
// ON LOAD
$(document).ready(function() { // When document is loaded
var height=$(window).height(); // Get height of window
height=height*.9; // Fill only 90% of window
height=height+"px"; // Add pixel suffix
$("#picBinDiv").css("height",height); // Set picBin height
$("#surfaceDiv").css("height",height); // Set surface height
AddPics(pics); // Add pics to pic bin
if (backPic) // If a background pic spec'd
{$("#surfaceDiv").append("<img src='"+backPic+"' height='"+height+"'/>");} // Add pic to div
else // No back
{$("#surfaceDiv").css("border","1px solid #999");} // Add border
});
// ADD PICS
function AddPics(picArray) // ADD PICS TO PIC BIN
{
var i,picHtml;
var n=picArray.length; // Number of pics to load
for (var i=0;i<n;++i) { // For each pic to load
picHtml="<img src='"+picArray[i]+"' "; // Add tag and url
picHtml+="id='pic"+i+"' "; // Add id
if (picHeight) // If height spec'd
picHtml+="height='"+picHeight+"px'"; // Scale by height
else if (picWidth) // If a width spec'd
picHtml+="width='"+picWidth+"px'"; // Scale by width
picHtml+="> "; // Add close tag and space
$("#picBinDiv").append(picHtml); // Add pic to div
$("#pic"+i).draggable(); // Make it draggable
}
}
</script>