通行证: 用户 密码 域名空间  下载中心 社区论坛 信息公告 my小屋
联系我们
设为首页
加入收藏

 

qq,asp,php,jsp,xml,sql,.net,编程 程序 网页图象 建站经验 私服
首页 | 新闻资讯 | 编程开发 | 网页设计 | 图形图象 | 网络媒体 | 网站模板 | 数 据 库 | 投稿
论坛 | 操作系统 | 系统优化 | 网络安全 | 黑客技术 | 硬件学堂 | 硬件报价 | 服 务 器 | 地图
专题 | 应用软件 | 聊天通讯 | q q 专栏 | 建站经验 | 在线工具 | 站长club | 注 册 表 | 旧版
社会 | 游戏娱乐 | 设计欣赏 | 疑难解答 | 社区论坛 | 网络赚钱 | 网站地图 | 广告服务 | 服务
当前位置:首页>>网页设计>>dreamweaver>>正文 新版上线![旧版]
注:打开慢时请稍等
在网页调用 windows 控件两例

http://www.iyit.net  日期:2006-5-5 10:25:43  来源:中国站长学院  点击:
参加讨论

一、这个是netmting的例子

<html>
<head>
<title>ocx</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<script language="javascript">
var flag=true
function showall(){
 alist = new array();
 newocx();
 list1.value = "";
 list2.value = "";
 list1.value = ocxtype.outerhtml;
 j = 0;
 for (i in ocxtype)
 {
  alist[j] = i;
  j++;
 }
 for (i = 0; i < alist.length; i++)
  for (j = (alist.length-1); j > 0; j--)
  {
   if (alist[j] < alist[j-1])
   {
    temps = alist[j];
    alist[j] = alist[j-1];
    alist[j-1] = temps;    
   }
  }
 for (i = 0; i < alist.length; i++)
  list2.value +=  alist[i] + "\n";
 alert("共有 "+alist.length+" 个属性方法")
}
function newocx()
{
 ocxfield.innerhtml = "<object id='ocxtype' width='0px' height='0px'" +
     "classid='clsid:" + ocxid.value + "'></object>";
}
</script>
</head>

<body bgcolor="#ffffff" text="#000000">

<div align="center">
  <p>classid
    <input type="text" id="ocxid" style="width:400" value="f3a614dc-abe0-11d2-a441-00c04f795683" onchange="jscript:flag=true">
    <input type="button" id="look" value="查看" onclick="showall()">
  </p>
  <table width="75%" border="1">
    <tr>
      <td height="24">
        <div align="center">html中的写法</div>
      </td>
      <td height="24">
        <div align="center">ocx中的属性事件</div>
      </td>
    </tr>
    <tr>
      <td>
        <textarea id="list1" style="width: 500px; height: 400px;" readonly></textarea>
      </td>
      <td>
        <textarea id="list2" style="width:250px; height:400px;" readonly></textarea>
      </td>
    </tr>
  </table>
</div>
<div id="ocxfield">
</div>
</body>
</html>

二、

<script language="javascript">
function showmessenger() {
if (messengerui.object != null) {
var msgrwindow
if (messengerui.mystatus == 2) {
msgrwindow = messengerui.window;
msgrwindow.show();
}
else
messengerui.signin(0,"","");
}
}

function showelement(element) {
element.style.display="";
document.msn.offline.value="on";
}
function hideelement(element) {
//rowshow.style.visibility="hidden";
element.style.display="none";
document.msn.offline.value="off";
}

function showhide(element) {
if (document.msn.offline.value=="on") {
hideelement(element);
}
else {
showelement(element);
}

}
</script>
<style type="text/css">
<!--
.small { font-size: 11px; font-family: verdana, arial, helvetica, sans-serif}
body { font-family: verdana, arial, helvetica, sans-serif}
a { color:#3d55c4 ; text-decoration: none}
a:link { color:#3d55c4 ; text-decoration: none}
a:hover { color:#000000 ; text-decoration: none}
-->
</style>
</head>

<body bgcolor="#ffffff" text="#000000" vlink="##3d55c4" onclick="(muser.innerhtml)">
<table cellpadding="1" cellspacing="1" bgcolor="#3d55c4" width="150" id="abc">
<script language="vbscript" id="mcvbs">
' this script is loosely based on the original script from microsoft.
' various flags and such for god-knows what...
dim a_
a_=false
dim b_,c_,d_
b_=false
c_=false
d_=false
dim e_,f_,g_
e_=false
f_=false
g_=3000 ' ooohhh! i know what this is! this is the amount of milliseconds for refresh
dim h_(),i_ ' h_() is an object array of users. this is also the cache
i_=0
' variables for different links to different images representing state in messenger... i think
dim j_,k_,l_,m_,n_,o_,p_,offl
j_="<object classid="""&"clsid:fb7199ab-79bf-11d2-8d94-0000f875c541"""&" codetype=application/x-oleobject id=msgrapp width=0 height=0></object>"
k_="<font class=""small"">"
m_="<img align=absbottom width=16 height=17 border=0 src="
l_="<br><b> <a href=""vbscript:op(-1)"" class=""color""><img src="http://www.iyit.net/files/beyondpic/2006-5/5/065510254171849.gif" border='0' alt=''>"&" sign in now... "&"</a></b>"
n_=m_&"msn_icons/online1.gif"&" alt="""&"online"&""">"
o_=m_&"msn_icons/busy1.gif"&" alt="""&"busy"&""">"
p_=m_&"msn_icons/idle1.gif"&" alt="""&"away"&""">"
'added by jh
offl = m_&"msn_icons/offline1.gif"&" alt="""&"offline"&""">"
m_="<img align=absbottom width=16 height=17 border=0 src="
dim q_
q_=false
dim ttl
ttl=0
' added arrays for online and offline contacts
dim ona() ' online contacts
dim offa() ' offline contacts
' counters for amount of online and offline
dim onctr
onctr=0
dim offctr
offctr=0
' online/offline?

sub drawinitialstate
on error resume next
dim r_
r_=msgrobj.localstate
if err then
a_=false
else
a_=true
end if
err.clear
if a_=true then
document.all.getmsgr.style.display="none"
drawcontacts
else
document.all.getmsgr.style.display="block"
end if
end sub

function hasmsgrapp()
appload.innerhtml = j_
on error resume next
dim r_
set r_=msgrapp
if err.description="" then
hasmsgrapp=true
else
hasmsgrapp=false
end if
err.clear
end function

sub refreshmc()
if a_ then
if c_ then
d_=true
else
d_=false
drawcontacts
setrefreshtimer
end if
end if
end sub

sub setrefreshtimer()
if not c_ then
c_=true
settimeout "dorefresh",g_,"vbscript"
end if
end sub

sub dorefresh()
c_=false
if d_ then
refreshmc
end if
end sub

sub drawcontacts
'********************************************************************
' modified by jh
' drawcontacts:
'
on error resume next
' new list of contacts to iterate thru
' ctr for list loop
dim i
i = 0
' strings for output
dim z, zz
z=""
zz=""
' for div visibility
dim mu,mo,msgl,nonel,noton,onli
mu="none"
mo="none"
msgl="none"
nonel="none"
noton="block"
onli="block"
if e_ then
mcclearcache
end if
' the heart of the matter
if msgrobj.localstate and 2 then
'online
if not f_ then
mcloadcache
end if
if i_>0 then
for i = 0 to ttl
select case h_(i).state
case 1
offctr = offctr + 1
case else
onctr = onctr + 1
end select
next
redim ona(onctr)
redim offa(offctr)
onctr = 0
offctr = 0
' loop to get friendlynames of contacts and put them in their respective arrays
for i = 0 to ttl
if h_(i).state=1 then
set offa(offctr)=h_(i)
offctr = offctr + 1
else
set ona(onctr) = h_(i)
onctr = onctr + 1
end if
next
' sort online users
sortusers2 0,onctr-1,true
for i = 0 to onctr-1
dim onl
dim h
onl=""
h=""
h = " href='vbscript:op(" & i & ")'"
onl = fixname(ona(i).friendlyname,17)
z = z & "<a" & h & " class=""color"">" & getstateimage(ona(i).state) & "</a> " & "<a " & h & " title="""
z = z & "send an instant message to " & onl & "."
z = z & """ class=""color"">" & k_ & onl
z = z & "</font></a><br>"
next
' sort offline users
sortusers2 0,offctr-1,false
for i = 0 to offctr-1
dim ofn
ofn=""
ofn = fixname(offa(i).friendlyname,17)
zz = zz & getstateimage(offa(i).state) & " "
zz = zz & k_ & ofn & "<br>"
next
if onctr > 0 then
mu="block"
mo="block"
document.all.muser.innerhtml=z
document.all.moff.innerhtml=zz
else
mu="block"
mo="block"
document.all.muser.innerhtml="<font class=""small"">none</font>"
document.all.moff.innerhtml=zz
end if
else
nonel="block"
document.all.noneol.innerhtml=k_&"your contact list is empty. <br><a href=vbscript:op(-2) class=""color"">add contacts to your list.</a>"&"</font>"
end if
else
if msgrobj.localstate=256 or msgrobj.localstate=512 then
msgl="block"
noton="none"
onli="none"
b_ = true
document.all.statu.innerhtml = "<br> <img src="http://www.iyit.net/files/beyondpic/2006-5/5/065510254171849.gif" border='0' alt=''> <b>connecting...</b></div>"
else
msgl="block"
noton="none"
onli="none"
if not b_ then
document.all.statu.innerhtml = l_
end if
end if
end if
document.all.online.style.display=onli
document.all.muser.style.display=mu
document.all.notonline.style.display=noton
document.all.moff.style.display=mo
document.all.msgrlogon.style.display=msgl
document.all.noneol.style.display=nonel
end sub

sub mcclearcache
i_=0
erase h_
erase ona
erase offa
f_=false
e_=false
d_=true
end sub

sub mcloadcache
dim bb_

set bb_=msgrobj.list(0)

dim cb_
cb_=0
dim db_
db_=bb_.count
ttl=db_ -1
redim h_(db_)
for each u in bb_
set h_(cb_)=u
cb_=cb_+1
next
i_=cb_
sortusers 0,i_-1
f_=true
end sub

' added by jh
' sorts online/offline users
sub sortusers2(eb_,fb_,ison)
dim gb_
if(ison) then
if fb_>eb_ then
gb_=ptnon(eb_,fb_)
sortusers2 eb_,gb_-1,true
sortusers2 gb_+1,fb_,true
end if
else
if fb_>eb_ then
gb_=ptnoff(eb_,fb_)
sortusers2 eb_,gb_-1,false
sortusers2 gb_+1,fb_,false
end if
end if
end sub

sub sortusers(eb_,fb_)
dim gb_
if fb_>eb_ then
gb_=ptn(eb_,fb_)
sortusers eb_,gb_-1
sortusers gb_+1,fb_
end if
end sub

' added by jh
'
function ptnon(eb_,fb_)
dim hb_,tmp
randomize
hb_=int(rnd()mod(fb_-eb_+1))+eb_
set tmp=ona(hb_)
set ona(hb_)=ona(eb_)
set ona(eb_)=tmp
dim a,b
a=eb_
b=fb_
while b>a
if strcomp(ona(b).friendlyname,tmp.friendlyname,1)>=0 then
b=b-1
else
set ona(a)=ona(b)
set ona(b)=ona(a+1)
set ona(a+1)=tmp
a=a+1
end if
wend
ptnon=a
end function

' added by jh
'
function ptnoff(eb_,fb_)
dim hb_,tmp
randomize
hb_=int(rnd()mod(fb_-eb_+1))+eb_
set tmp=offa(hb_)
set offa(hb_)=offa(eb_)
set offa(eb_)=tmp
dim a,b
a=eb_
b=fb_
while b>a
if strcomp(offa(b).friendlyname,tmp.friendlyname,1)>=0 then
b=b-1
else
set offa(a)=offa(b)
set offa(b)=offa(a+1)
set offa(a+1)=tmp
a=a+1
end if
wend
ptnoff=a
end function

sub msgrobj_onlocalstatechangeresult(byval hr,byval mlocalstate,pservice)
if 0=hr and err.description="" and a_ then
if mlocalstate=256 or mlocalstate=512 then
b_=true
document.all.statu.innerhtml="signing in..."
elseif mlocalstate=1024 then
b_=true
document.all.statu.innerhtml="signing out..."
elseif mlocalstate=1 then
b_=true
document.all.statu.innerhtml=l_
end if
refreshmc
end if
end sub

sub msgrobj_onuserstatechanged(puser,byval mprevstate,pfenabledefault)
'if err.description="" then
mcclearcache
b_=false
refreshmc
'end if
end sub

sub msgrobj_onlistremoveresult(byval hr,byval mlist,byval puser)
if 0=hr and 0=mlist and err.description="" then
e_=true
refreshmc
end if
end sub

sub msgrobj_onlistaddresult(byval hr,byval mlist,byval puser)
if 0=hr and 0=mlist and err.description="" then
e_=true
refreshmc
end if
end sub

sub msgrobj_onlogonresult(byval hr,byval pservice)
if 0=hr and err.description="" then
mcclearcache
b_=false
refreshmc
else
mcclearcache
b_=false
refreshmc
end if
end sub

sub msgrobj_onlogoff()
mcclearcache
b_=false
refreshmc
end sub

sub msgrobj_onappshutdown()
refreshmc
end sub


' launches chat window for a given user, or
' launches the logon window, or simply brings up
' messenger to show all contacts.
function op(n)
if hasmsgrapp then
if n>=0 then
document.all.mctrack.src="p/6/"
on error resume next
msgrapp.launchimui ona(n)
elseif-1=n then
msgrapp.launchlogonui
else
msgrapp.visible=1
end if
end if
end function

function htmlesc(str)
str=replace(str,"&","&")
str=replace(str,"<","<")
htmlesc=replace(str,">",">")
end function

function fixname(s,max)
if len(s)>max then
s=left(s,max-2)&"..."
end if
fixname=htmlesc(s)
end function

function getstateimage(t)
select case t
case 1
getstateimage=offl 'offline
case 2
getstateimage=n_ 'online
case 10
getstateimage=o_ 'busy
case 14
getstateimage=p_ 'brb
case 18
getstateimage=p_ 'away
case 34
getstateimage=p_ 'away... as well.......
case 50
getstateimage=o_ 'on the phone
case 66
getstateimage=o_ 'out to lunch
end select
end function
</script>

<object id=msgrobj height=0 codetype=application/x-oleobject width=0
classid=clsid:f3a614dc-abe0-11d2-a441-00c04f795683>
<span style="display:none;"> </span>
</object>

<script language="vbscript" event="onreadystatechange" for="mcvbs">
if mcvbs.readystate="complete" and not isdrawn_ then
isdrawn_=true
drawinitialstate
end if
</script>

<script language="vbscript" event="onload" for="window">
if not isdrawn_ then
isdrawn_=true
drawinitialstate
call hideelement(moff)
end if
</script>

<tr bgcolor="#3d55c4">
<td class="small">
<div class="small" align=center id="msngrheading" style="width:100%; color: #eff7ff; background-color:#3d55c4; padding:3px; padding-left:0px;"><b>msn messenger</b></div>

</td>
</tr>
<tr>
<td bgcolor="#eff7ff" class="small">
<div id="getmsgr" class="small" align=center style="display:none;color:#000000;"><br>download<br><a href="http://messenger.msn.com/">windows messenger</a>
<img id="mctrack" height="1" alt width="1">
</div>
<div id="msgrlogon" class="small" style="display:none">
<div id="statu" class="small" style="color:#000000"></div>
</div>
<!--online-->
<div id="online" class="small" style="display:none;color:#000000"></div>
<div id="noneol" class="small" style="display:none;color:#000000"></div>
<div id="muser" class="small" style="display:none;color:#000000"></div>
<br>
<!--offline-->
<div id="notonline" class="small" style="display:none;color:#000000">
<b><a href="javascript:void(null)" onclick="showhide(moff)" class="small"><img border="0" src="http://www.iyit.net/files/beyondpic/2006-5/5/065510254252632.gif" width="16" height="16"> buddies offline</a></b>
</div>
<div id="moff" class="small" style="display:none; color:#000000"></div>
<span id="appload" class="small" style="display: none"></span>
</td>
<form name="msn">
<input type="hidden" value="on" name="offline">
</form>
</tr>
</table>
<br>



编辑:黑鹰 [发送给好友] [打印本页] [关闭窗口] [返回顶部]
上一篇:用 onerror 获取错误信息
下一篇:javascript 对象与数组参考大全
转载请注明来源:www.iyit.net
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。

 相关文章
最新更新 热点排行 推荐新闻
去除dw mx 2004表格宽度辅助
驯服不听话的网页表格
dw mx 2004代码编辑新功能
细品dw mx 2004内建fw技术
用 javascript 写的一个映射表类
ajax的七宗罪
驳“ajax 的七宗罪”
javascript 实用的一些技巧 
奇妙的javascript图片放大镜
网页制作技巧24条
网页保存另类技巧3则
设计高手进阶技巧:用记事本编辑网页
高手传经 网页设计中的几个小技巧
从美的原则谈网页上的艺术表现:美的原
传统二维动画和flash动画的比较
去除dw mx 2004表格宽度辅助
驯服不听话的网页表格
dw mx 2004代码编辑新功能
细品dw mx 2004内建fw技术
用 javascript 写的一个映射表类
qq珊瑚虫外挂4.0版本发布!
多个广告位招商!
摄影后期系列一:1分钟为数码相片去红眼
教您显示器亮度对比度的调节
qq挂机说明
asp进度条
photoshop通道抠图:给秀发飞扬的mm照
新版上线,今日正式开通!!!
更多精彩图文广告等着您!
免费在qq上看在线电影电视听音乐
第二十章 开发delphi对象式数据管理功
sql简明教程(1)
vbscript和javascript互相调用 
jsp教程(四)-jsp actions的使用
操作系统被入侵后的修复过程
五一别忘电脑防毒 养成良好上网习惯
google对ie浏览器将捆绑搜索功能表担忧
新版上线,今日正式开通!!!
用photoshop创意图形“岁月”
摄影后期系列一:1分钟为数码相片去红眼

 友情链接
设置首 页 - 版权声明 - 广告服务 - 关于我们 - 联系我们 - 友情连接
copyrights © 2004-2006 iyit.net all rights reserved.
网站合作、广告联系qq:147007642、466949678
易特网络技术 点击这里给我发消息