Chrome浏览器扩展程序显示日期和时间

时间:2017-04-07 11:32:05

标签: javascript google-chrome-extension

我正在尝试使用我的浏览器扩展程序来显示我点击它时的当前日期和时间。我目前的代码在浏览器中正确显示日期和时间,但不在扩展程序中。

Html代码:

<html>
    <body>
	<div class="centre2" >
        <div style="display:flex">
            <div>
                <a href="popup.html" ><img src="images/a.png" width="30" height="30" style="padding:7px;"/a>
            </div> 
             <div>
                 <a href="popup.html"> <img src="images/b.png"  width="30" height="30" style="padding:7px;"/a>
             </div>
			 <div>
                 <a href="stratinium.com"> <img src="images/c.png"  width="30" height="30" style="padding:7px;"/a>
             </div>
        </div>
		</div>
		<br><br>
		<hr><br>
		<p class="marquee">
    <span id="dtText"></span>
		</p>


	  <style>
		html
		{
		width: 200px;
		overflow-y:hidden;
		}
		div.centre2{
		 border: 2px solid black;
        border-radius: 5px;
		}
		.marquee {
   width: 180px;
   margin: 0 auto;
   background:white;
   white-space: nowrap;
   overflow: hidden;
   box-sizing: border-box;
   color:black;
   font-size:18px;
}

.marquee span {
   display: inline-block;
   padding-left: 100%;
   text-indent: 0;
   animation: marquee 10s linear infinite;
}

.marquee span:hover {
    animation-play-state: paused
}

@keyframes marquee {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}
		</style>
		<script>
		var today = new Date();
		document.getElementById('dtText').innerHTML=today;
		</script>
    </body>
</html>

感谢任何帮助!

0 个答案:

没有答案