暑期缤纷巨献之~------超级+无敌--------XML+javascript+ASP在线短信息功能!(1)
发表于:2007-06-30来源:作者:点击数:
标签:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +超级+无敌--------XML+JAVASCRIPT+ASP在线短信息功能---介绍 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 来看看登陆页面LOGIN.ASP,代码比较长,也可
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ 超级+无敌--------XML+JAVASCRIPT+ASP在线短信息功能---介绍
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
来看看登陆页面LOGIN.ASP,代码比较长,也可以修改一下页面,使它更美观:
<%option explicit
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = 0
%>
<!DOCTYPE HTML PUBLIC "-//IETF//D
TD HTML//EN">
<html>
<head>
<title></title>
<!--#include Virtual="/turbo/Inc/checkUsers_inc.asp"-->
<!--上面加载的是一个验证用户登陆的密码和用户名的文件,这里就不列举了.重要的是,
这个文件,如果用户登陆成功,会生成2个COOKIES,一个叫MyID,保存的是用户的ID,
一个叫MyName,保存的是用户的用户名.这2个COOKIES很重要,将在以后用到.
-->
<!--下面的JAVASCRIPT代码应该把它存为一个JS文件,那样以后用户再次访问.速度会加快-->
<SCRIPT LANGUAGE=
Javascript>
<!--
function SendInformation() // 如果有新信息,点击ID为INFORMATION的DIV,就弹出查看信息的窗口
{
if( Count < (XmlDom_Length-1))
{
playmusic(‘’music1‘’,‘’play()‘’)
Count = Count + 1
}
else
{
Count = Count + 1
eChang(false)
}
OpenWin("../onlineInformation/GetInformation.htm","GetInformation")
}
function OpenWin(Url,WinName) //打开新窗口的函数
{
window.open(Url,WinName,"width=324,height=214,resizable=no,scrollbars=no,left=" +((screen.availWidth/2)-200) + ",top=" + ((screen.availHeight/2)-150))
}
function ReMove() //这个函数是删除用户已经看过的信息.删除完再重新刷新XML数据.
{
XmlDomHttp.open("POST","../onlineInformation/eChangXml.asp",false)
XmlDomHttp.send(XmlDom)
Dom.loadXML(XmlDomHttp.responseText)
if(Dom.parseError.errorCode != 0)
{
alert("Sorry.\b出现了错误.在线信息功能已经停止.你可以按\b\"刷新\"\b再试一次!!.")
}
else
{
if(eval(Dom.documentElement.childNodes.item(0).text))
{
alert("Sorry.\b出现了错误.在线信息功能已经停止.你可以按\b\"刷新\"\b再试一次.")
}
else
{
GetXmlData()
}
}
}
function eChang(Bool) //改变DIV的值
{
var Str
if(Bool)
{
Str = "<a href=\"
javascript:SendInformation()\"><img src=\"../onlineInformation/image/yes.gif\" border=\"0\"></a>"
}
else
{
Str = "..<b><font size=\"3\">Welcome</font></b>.."
}
document.all["Information"].innerHTML = Str
}
var XmlDom = new ActiveXObject("Microsoft.XMLDOM")
XmlDom.async=false
var Dom = new ActiveXObject("Microsoft.XMLDOM")
Dom.async=false
var Path = "../onlineInformation/Xml/<%=Request.Cookies("MyID")%>.xml"
//上面这个Path变量就是用户的个人XML数据文件地址,还记得刚刚登陆时生成的存放用户ID的COOKIES吗?
var XmlDomHttp = new ActiveXObject("Microsoft.XMLHTTP")
var Img = new Image()
Img.src = "../onlineInformation/image/yes.gif"
//这里先加载有新信息到达就显示的GIF动画.
var XmlDom_Length
var Count
function GetXmlData() //这就是刷新用户XML数据的函数
{
XmlDom.load(Path)
Count = 0
if(XmlDom.parseError.errorCode != 0)
{
alert("Sorry.出现了错误.在线信息功能已经停止")
return
}
XmlDom_Length = XmlDom.documentElement.childNodes.length
if(XmlDom_Length != 0)
{
eChang(true)
playmusic(‘’music1‘’,‘’play()‘’)
}
else
{
setTimeout("GetXmlData()","3000")
}
}
function playmusic(music,pl) // 播放 | 停止声音
{
eval("document.all[\""+music+"\"]."+pl)
}
-->
</SCRIPT>
</head>
<body onload="GetXmlData()">
<EMBED NAME=‘’music1‘’ SRC=‘’../onlineInformation/music/msg.wav‘’ LOOP=false AUTOSTART=false MASTERSOUND HIDDEN=true WIDTH=0 HEIGHT=0>
<!--上面加载了QQ的声音文件,这个文件你可以在QQ的安装目录里找到-->
<div id="Layer20" style="position:absolute; left:0px; top:0px; width:120px; height:19px; z-index:81">
<table width="120" border="0" cellspacing="0" cellpadding="0" bgcolor="#B3AFA2" style="border-left: 1 solid #666666; border-right: 1 solid #666666; border-top: 1 solid #666666">
<tr>
<
td bgcolor="#aaa697" height="20" style="border-bottom: 1 solid #666666">
<div align="center" id="Information">..<b><font size="3">Welcome</font></b>..</div>
<!--上面的这个<DIV>就是以后有新信息到达,用来显示一个小动画来提示用户有新信息-->
</td>
</tr>
<tr>
<td height="20"> </td>
</tr>
</table>
</div>
</body></html>
--------------------等一下再看看其余的文件---------------------------------------------
原文转自:http://www.ltesting.net