读书人

在createPopup()中怎么按时间动态加入

发布时间: 2012-02-04 15:43:09 作者: rapoo

在createPopup()中如何按时间动态加入问候语?
下面是弹出窗口并显示消息的js代码:

<%@LANGUAGE= "VBSCRIPT " CODEPAGE= "936 "%>
<SCRIPT>
var oPopup = window.createPopup();
var popTop=50;
function popmsg(msgstr){
var winstr= " <table style=\ "border:2 solid #6D93C8\ " width=\ "241\ " height=\ "172\ " cellspacing=\ "3\ " bgcolor=\ "lightblue\ "> ";
winstr+= " <tr> <td height=\ "30\ "> </td> </tr> <tr> <td align=\ "center\ "> <table width=\ "90%\ " height=\ "110\ " border=\ "0\ " cellpadding=\ "0\ "> ";
winstr+= " <tr> <td valign=\ "top\ " style=\ "font-size:12px; color: #6D93C8; face:

Tahoma\ "> "+msgstr+ " </td> </tr> </table> </td> </tr> </table> ";
oPopup.document.body.innerHTML = winstr;
popshow();
}

function popshow(){
window.status=popTop;
if(popTop> 1720){
clearTimeout(mytime);
oPopup.hide();
return;
}else if(popTop> 1520&&popTop <1720){
oPopup.show(screen.width-250,screen.height,241,1720-popTop);
}else if(popTop> 1500&&popTop <1520){
oPopup.show(screen.width-250,screen.height+(popTop-1720),241,172);
}else if(popTop <180){
oPopup.show(screen.width-250,screen.height,241,popTop);
}else if(popTop <220){
oPopup.show(screen.width-250,screen.height-popTop,241,172);
}
popTop+=10;


var mytime=setTimeout( "popshow(); ",50);
}
popmsg( "问候语 ");
</SCRIPT>

如何根据服务器的时间按照不同时间在弹出窗口中显示不同的问候语,应该如何调用popmsg()?

<% if time <#12:00:00# and time> =#6:00:00# then
popmsg( "上午好 ");
elseif time> =#12:00:00# and time <#18:00:00# then
popmsg( "下午好 ");
else popmessage( "晚上好 ");
endif
%>

[解决办法]
<% if time <#12:00:00# and time> =#6:00:00# then
response.write " <script> popmsg( '上午好 '); </script> "
elseif time> =#12:00:00# and time <#18:00:00# then
response.write " <script> popmsg( '下午好 '); </script> "
else
response.write " <script> popmessage( '晚上好 '); </script> "
end if
%>
[解决办法]
If (Hour(Now) < 6) Then
Response.Write " <font color=##0066FF> 凌晨好! </font> "
ElseIf (Hour(Now) < 9) Then
Response.Write " <font color=##000099> 早上好! </font> "
ElseIf (Hour(Now) < 12) Then
Response.Write " <font color=##FF6699> 上午好! </font> "
ElseIf (Hour(Now) < 14) Then
Response.Write " <font color=##FF6600> 中午好! </font> "
ElseIf (Hour(Now) < 17) Then
Response.Write " <font color=##FF00FF> 下午好! </font> "
ElseIf (Hour(Now) < 18) Then
Response.Write " <font color=##0033FF> 傍晚好! </font> "
Else
Response.Write " <font color=##ff0000> 晚上好! </font> "
End If

读书人网 >ASP

热点推荐