如何用Javascript检查Adobe PDF插件是否安装
用Javascript检查Adobe PDF插件是否安装的代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<mce:script type="text/javascript"><!--
function isAcrobatPluginInstall(){
//如果是firefox浏览器
if (navigator.plugins && navigator.plugins.length) {
for (x=0; x<navigator.plugins.length;x++) {
if (navigator.plugins[x].name== 'Adobe Acrobat')
return true;
}
}
//下面代码都是处理IE浏览器的情况
else if (window.ActiveXObject)
{
for (x=2; x<10; x++)
{
try
{
oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");
if (oAcro)
{
return true;
}
}
catch(e) {}
}
try
{
oAcro4=new ActiveXObject('PDF.PdfCtrl.1');
if (oAcro4)
return true;
}
catch(e) {}
try
{
oAcro7=new ActiveXObject('AcroPDF.PDF.1');
if (oAcro7)
return true;
}
catch(e) {}
}
}
// --></mce:script>
</head>
<body>
<input type="button" name="kkk" value="点击检查Adobe Acrobat 插件是否安装" onclick="if(isAcrobatPluginInstall()) alert('Adobe Acrobat 插件已安装');" />
</body>
</html>
上面代码在IE6.0和firefox 3.0下运行通过。
相关文档:
js鼠标事件大全2008年01月14日 星期一 08:54一般事件 事件 浏览器支持 描述
onClick IE3|N2|O3 鼠标点击事件,多用在某个对象控制的范围内的鼠标点击
onDblClick IE4|N4|O 鼠标双击事件
onMouseDown IE4|N4|O 鼠标上的按钮被按下了
onMouseUp IE4|N4|O 鼠标按下后,松开时激发的事件
onMouseO ......
定义和用法
eval() 函数可计算某个字符串,并执行其中的的 JavaScript 代码。
语法
eval(string)
参数描述
string
必需。要计算的字符串,其中含有要计算的 JavaScript 表达式或要执行的语句。
返回值
通过计算 string 得到的值(如果有的话 ......
一 Undefined 类型
只有一种值 undefined
以下三种情况typeof 返回类型为undefined
1. 当变量未初始化时
2. 变量未定义时
3. 函数无明确返回值时(函数没有返回值时返回的都是undefined)
undefined 并不等同于未定义的值
typeof 并不真正区分是否是未定义
看以下示例代码:
var oTemp;
alert(typeof o ......
substr 取部份字符串。 语法: string substr(string string, int start, int [length]); 返回值: 字符串 函数种类: 资料处理 内容说明 本函数将字符串 string 的第 start 位起的字符串取出 length 个字符。若 start 为负数,则从字符串尾端算起。若可省略的参数 length 存在,但为负数,则表示取到倒数第 length 个字 ......
43、JavaScript主页弹出窗口技巧
窗口中间弹出
<script>
window.open("http://www.cctv.com","","width=400,height=240,top="+(screen.availHeight-240)/2+",left="+(screen.availWidth-400)/2);
</script>
============
<html>
<head>
<script language="LiveScript">
fu ......