IE浏览器里面链接点击在Chrome浏览器打开

常用网址汇总成一个网页,需要可以选择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">&times;</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>

显示结果如下:

点击跳转:

正常工作。

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值