使用jquery创建弹出内容 [英] creating popup content with jquery

查看:116
本文介绍了使用jquery创建弹出内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有这段代码

<p id="test">
  some content
<p>
<a href="#" id="test-link">Open</a>

现在我想 - 使用javascript / jquery-创建一个弹出窗口,窗口内容就是内容 test 段落,点击 test-link 时。
怎么办呢?

Now i want -using javascript/jquery- to create a popup window, the window content is the content of test paragraph, when test-link is clicked. How could this be done?

推荐答案

  <a href="javascript:popup();"  id="test-link">Open</a>

function popup()
{
  var generator=window.open('','name','height=400,width=500');

  generator.document.write('<html><head><title>Popup</title>');
  generator.document.write($("#test").html());
  generator.document.write('</body></html>');
  generator.document.close();
}

这篇关于使用jquery创建弹出内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆