大家好,这是我试图使这个扩展的项目将从列表中随机选择一个图片并显示它。当你在chrome中打开index.html时会显示它,但是当它是一个扩展时,我没有任何新的chrome扩展。谢谢 这是我的代码
<html>
<script type="text/javascript">
var imageURLs = [
"http://www.myserver.com/images/image1.png"
, "http://www.myserver.com/images/image2.png"
, "http://www.myserver.com/images/image3.png"
];
function getImageTag() {
var img = '<img src=\"';
var randomIndex = Math.floor(Math.random() * imageURLs.length);
img += imageURLs[randomIndex];
img += '\" alt=\"Some alt text\"/>';
return img;
}
</script>
</head>
<body>
<script type="text/javascript">
document.write(getImageTag());
</script>
</body>
<style>
#container{
top: 0;
right: 0;
bottom: 0;
left: 0;
}
body {
font-family: "Segoe UI", "Lucida Grande", Tahoma, sans-serif;
font-size: 100%;
-webkit-user-drag: none;
-webkit-user-select: none;
overflow: hidden;
width: 400px;
height: 400px;
}
#status {
/* avoid an excessively wide status text */
white-space: pre;
text-overflow: ellipsis;
overflow: hidden;
max-width: 400px;
}
</style>
<div id="container">
</html>