在hta应用程序中使用HTML和Javascript显示当前日期和时间的滚动效果 [英] Display the current date and time using HTML and Javascript with scrollable effects in hta application
问题描述
我有以下的java脚本显示当前日期在给定的格式在星期六6月2 17:54:28 UTC + 0530 2014在hta(html应用程序),现在我想让这种出现在一种方式像欢迎使用我的系统的当前日期: Mon Jun 2 17:54:28 UTC + 0530 2014 ,此文本应为可滚动的影响,例如:从右向左移动。
I have the below java-script to display the current date in the given format Mon Jun 2 17:54:28 UTC+0530 2014 in a hta(html application), now I want to make this appear in a way like Welcome the current date of my system: Mon Jun 2 17:54:28 UTC+0530 2014 and this text should be a having scrollable affects for eg: one moving from right to left.
我试图使用下面的标签获取可滚动的文本,但是如何调用这个java脚本变量在< marquee> / code>标签,以便我得到今天的日期和时间也作为可滚动的影响的一部分,但它不工作在我的HTML页面。
I tried to use the below tag to get a scrollable text but how can I call this java-script variable in the <marquee>
tag so that I get the today's date and time also as a part of the scrollable affects but it is not working for my HTML page.
请让我知道如何纠正此问题
Kindly let me know how to rectify this issue
HTML CODE: / p>
HTML CODE:
<marquee behavior="scroll" bgcolor="yellow" loop="-1" width="30%">
<i><font color="blue"><strong>Welcome</strong> Today's date is : </font></i>
</marquee>
JAVASCRIPT以显示目前日期和时间: b
$ b
JAVASCRIPT TO DISPLAY THE CURRENT DATE AND TIME:
<script language="javascript">
var today = new Date();
document.write(today);
</script>
推荐答案
方法1:
使用 marquee
标记。
HTML
<marquee behavior="scroll" bgcolor="yellow" loop="-1" width="30%">
<i>
<font color="blue">
Today's date is :
<strong>
<span id="time"></span>
</strong>
</font>
</i>
</marquee>
JS
var today = new Date();
document.getElementById('time').innerHTML=today;
Fiddle demo here
没有 marquee
标记和 CSS
。
HTML
<p class="marquee">
<span id="dtText"></span>
</p>
CSS
.marquee {
width: 350px;
margin: 0 auto;
background:yellow;
white-space: nowrap;
overflow: hidden;
box-sizing: border-box;
color:blue;
font-size:18px;
}
.marquee span {
display: inline-block;
padding-left: 100%;
text-indent: 0;
animation: marquee 15s linear infinite;
}
.marquee span:hover {
animation-play-state: paused
}
@keyframes marquee {
0% { transform: translate(0, 0); }
100% { transform: translate(-100%, 0); }
}
JS
var today = new Date();
document.getElementById('dtText').innerHTML=today;
Fiddle demo here
这篇关于在hta应用程序中使用HTML和Javascript显示当前日期和时间的滚动效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!