怎么把a链接传过来的内容做弹窗显示

2025-12-04 10:35:45

1、这里我们只需要加一行代码就好了,如果是新建一个窗口,这个时候我们需要将a标签的target这个属性改为“_blank”就可以了,例如

<a href="#" target="_blank" onclick="tan()">这是一个弹窗</a>

2、如果我们是需要一个弹窗这个时候可以用js来实现代码如下:注意我们在实现的时候不要加target="_blank" 

<head>

<meta charset="UTF-8">


   <title>Title</title>
   <script LANGUAGE="javascript">
       //这句要写成一行
       function tan(){
       window.open('123.html', 'newwindow', 'height=100, width=400, top=0, left=0, t' +
           'oolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no')
       }
   </script>
</head>
<body>
<a href="#"  onclick="tan()">这是一个弹窗</a>
</body>
</html>

怎么把a链接传过来的内容做弹窗显示

怎么把a链接传过来的内容做弹窗显示

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢