当前位置:编程学习 > asp >>

介绍一个判断plug-ins/ActiveX 是否存在的例子

答案:这里就以在IE3.02和Netscape3+的浏览器为例,介绍关于Flash(以Flash2为例)插件是否安装.
<%  
    a = lcase(request.servervariables("http_user_agent"))
    if instr(a,"msie")>0 then
        if instr(a,"98")>0 or instr(a,"95")>0 or instr(a,"nt")>0 then
            ie32="true"
            ' IE 3 or greater on 32-bit
        end if
    elseif instr(a,"mozilla/3")>0 or instr(a,"mozilla/4")>0 then
        if instr(a,"opera")<=0 then
            nn="true"
            ' Netscape 3 or greater
        end if
    end if

    if ie32 then
%>

    <script language="vbscript">
    if scriptEngineMajorVersion > 1 then
        on error resume next
        FIn=(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash")))
        if FIn then
            msgbox "Flash插件已安装!"
        else
            msgbox "Flash插件没安装."
        end if
    end if
    </script>

<%
    elseif nn then
%>

    <script language="javascript">
    FIn = navigator.plugins["Shockwave Flash 2.0"];
    if (FIn)
    {
        alert("Flash插件已安装!");
    }
    else
    {
        alert("Flash插件没安装.");
    }
    </script>

<%
    end if
%>

上一个:javascript对象.属性集锦(建议加入精华区)
下一个:不用询问关闭一个独立的窗口代码

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,