常用网址汇总成一个网页,需要可以选择chrome或者IE浏览器打开,网址都是IP地址,基于IE浏览器开发,因此默认选择IE浏览器打开,跳转到chrome浏览器打开。
<!DOCTYPE html>
<html lang="zh-CN">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>常用网址</title>
<link rel="shortcut icon" href="favicon.ico" />
<link href="./index/css/bootstrap.min.css" rel="stylesheet" media="screen" />
<link href="./index/css/style.css" rel="stylesheet" />
<link href="./index/css/bootstro.min.css" rel="stylesheet" />
<link href="./index/css/bootstrap-responsive.min.css" rel="stylesheet" />
<!--[if lt IE 9]>
<![endif]-->
<script>
function test(myurl) {
/*
创建ActiveXObject实例,只在IE下有效,才可以创建
*/
var url = myurl;
var objShell= new ActiveXObject("WScript.Shell");
/*
命令参数说明
cmd.exe /c dir 是执行完dir命令后关闭命令窗口。
cmd.exe /k dir 是执行完dir命令后不关闭命令窗口。
cmd.exe /c start dir 会打开一个新窗口后执行dir指令,原窗口会关闭。
cmd.exe /k start dir 会打开一个新窗口后执行dir指令,原窗口不会关闭。
这里的dir是start chrome www.baidu.com//用谷歌浏览器打开百度
*/
//objShell.Run("cmd.exe /c start chrome www.baidu.com",0,true);
var cmd = "cmd.exe /c start chrome " + url;
objShell.Run(cmd, 0, true);
//objShell.Run("cmd.exe /c start chrome myurl",0,true);
}
</script>
</head>
<body>
<header class="title">
<section class="container">
<!--[if IE 8]>
<div class="alert">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>警告!</strong> 您的浏览器版本过低,可能部分功能无法使用.
</div>
<![endif]-->
<hgroup>
<h1 class="side">常用网址链接汇总</h1>
<h2 class="side">
<p>IE浏览器</p>
</h2>
</hgroup>
</section>
<section id="head-bottom1">
<script src="https://www.pythontab.com/statics/js/coop/docs_header.js?v=095" type="text/javascript"></script>
</section>
</header>
<section class="bread">
<ul class="breadcrumb container">
</ul>
</section>
<section class="container">
<article class="content">
<ul class="thumbnails">
<li class="span4">
<section class="thumbnail">
<a href="http://docs.pythontab.com/tensorflow/" target="_blank">
<img class="img-rounded lazy" src="./index/images/textloading.gif" data-original="./index/images/tensorflow_logo.jpg"
alt="手册" style="display: inline;" />
</a>
<h3 class="text-left">手册</h3>
<section style="height:35px;padding:0 5px 0 0;">
<section class="btn-group pull-right">
<button class="btn btn-info" target="_blank" onclick="test('http://docs.pythontab.com/tensorflow/')">Chrome打开</button>
<a href="http://docs.pythontab.com/tensorflow/" class="btn btn-info" target="_blank">IE打开</a>
</section>
</section>
</section>
</li>
</ul>
</article>
</section>
<section class="container">
<nav class="pager"></nav>
</section>
<footer class="footer">
<section class="container">
<p>反馈邮箱:
<a style="padding:0 5px 0 0" href="http://webmail.51biz.com/" target="_blank">你的邮箱</a><br>
运维组
</p>
</section>
</footer>
<script src="/index/js/jquery-1.10.1.min.js"></script>
<script src="/index/js/jquery.lazyload.min.js"></script>
<script src="/index/js/jquery.scrollUp.min.js"></script>
<script src="/index/js/bootstro.min.js"></script>
<script src="/index/js/bootstrap.min.js"></script>
<script src="/index/js/basic.js"></script>
</body>
</html>
关键js代码如下:
<script>
function test(myurl) {
/*
创建ActiveXObject实例,只在IE下有效,才可以创建
*/
var url = myurl;
var objShell= new ActiveXObject("WScript.Shell");
/*
命令参数说明
cmd.exe /c dir 是执行完dir命令后关闭命令窗口。
cmd.exe /k dir 是执行完dir命令后不关闭命令窗口。
cmd.exe /c start dir 会打开一个新窗口后执行dir指令,原窗口会关闭。
cmd.exe /k start dir 会打开一个新窗口后执行dir指令,原窗口不会关闭。
这里的dir是start chrome www.baidu.com//用谷歌浏览器打开百度
*/
//objShell.Run("cmd.exe /c start chrome www.baidu.com",0,true);
var cmd = "cmd.exe /c start chrome " + url;
objShell.Run(cmd, 0, true);
//objShell.Run("cmd.exe /c start chrome myurl",0,true);
}
</script>
网页关键代码如下:
<li class="span4">
<section class="thumbnail">
<a href="http://docs.pythontab.com/tensorflow/" target="_blank">
<img class="img-rounded lazy" src="./index/images/textloading.gif" data-original="./index/images/tensorflow_logo.jpg"
alt="TensorFlow中文手册" style="display: inline;" />
</a>
<h3 class="text-left">TensorFlow中文手册</h3>
<section style="height:35px;padding:0 5px 0 0;">
<section class="btn-group pull-right">
<button class="btn btn-info" target="_blank" onclick="test('http://docs.pythontab.com/tensorflow/')">Chrome打开</button>
<a href="http://docs.pythontab.com/tensorflow/" class="btn btn-info" target="_blank">IE打开</a>
</section>
</section>
</section>
</li>
显示结果如下:
点击跳转:
正常工作。