求asp代码解释,尽量详细点
<script>functiontick(){varye,mo,davarhours,minutes,seconds,xfile;varintHours,intMinut...
<script>
function tick() {
var ye,mo,da
var hours, minutes, seconds, xfile;
var intHours, intMinutes, intSeconds;
var today;
today = new Date();
ye = today.getYear();
mo = today.getMonth()+1;
if (mo < 10) {
mo = "0"+mo;
}
da = today.getDate();
if (da < 10) {
da = "0"+da;
}
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
if (intHours == 0) {
hours = "12:";
xfile = "PM";//午夜
} else if (intHours < 12) {
hours = intHours+":";
xfile = "AM";//上午
} else if (intHours == 12) {
hours = "12:";
xfile = "PM";//正午
} else {
intHours = intHours - 12
hours = intHours + ":";
xfile = "PM";//下午
}
if (intHours < 10) {
hours = "0"+intHours+":";
}
if (intMinutes < 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
}
if (intSeconds < 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
}
var color, size, face, out;
var text = "black";
var font_size = 1;
var font_face = "Arial";
color = (text)? text : "black";
size = (font_size)? font_size : 1;
face = (font_face)? font_face : "Arial";
timeString = "<font style='font-size:14px;'>当前时间:";
timeString += ye+"-"+mo+"-"+da+" ";
timeString += hours+minutes+seconds+" "+xfile+" ";
Clock.innerHTML = timeString;
window.setTimeout("tick();", 100);
}
window.onload = tick;
</script> 展开
function tick() {
var ye,mo,da
var hours, minutes, seconds, xfile;
var intHours, intMinutes, intSeconds;
var today;
today = new Date();
ye = today.getYear();
mo = today.getMonth()+1;
if (mo < 10) {
mo = "0"+mo;
}
da = today.getDate();
if (da < 10) {
da = "0"+da;
}
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
if (intHours == 0) {
hours = "12:";
xfile = "PM";//午夜
} else if (intHours < 12) {
hours = intHours+":";
xfile = "AM";//上午
} else if (intHours == 12) {
hours = "12:";
xfile = "PM";//正午
} else {
intHours = intHours - 12
hours = intHours + ":";
xfile = "PM";//下午
}
if (intHours < 10) {
hours = "0"+intHours+":";
}
if (intMinutes < 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
}
if (intSeconds < 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
}
var color, size, face, out;
var text = "black";
var font_size = 1;
var font_face = "Arial";
color = (text)? text : "black";
size = (font_size)? font_size : 1;
face = (font_face)? font_face : "Arial";
timeString = "<font style='font-size:14px;'>当前时间:";
timeString += ye+"-"+mo+"-"+da+" ";
timeString += hours+minutes+seconds+" "+xfile+" ";
Clock.innerHTML = timeString;
window.setTimeout("tick();", 100);
}
window.onload = tick;
</script> 展开
3个回答
展开全部
这个代码的作用是在网页上显示当前时间,例如,当前时间是某年某月某日几点几分上午
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这是java脚本,不是asp的。
追问
那这是什么意思啊?是时间的设置编辑吗
追答
这段代码的意思是网页加载完毕后,执行tick()这个函数,这个函数会把自己设置为不断刷新回调自己,该函数的定义功能是在ID为Clock的网页元素内实时刷新当前时间。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
asp也可以调用javascript,
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询