开发者

How to open part of my page content into own broswer?

if I have a page:

<body>
  <div id='part_one'>...</div>
  <div id='part_two'>...</div>
  <div id='part_thre开发者_Go百科e'>...</div>

  //Create a link here to open the content of div `part_two` in own browser
</body>

I would like to create a link on the page, when user click on the link, the content of div part_two will be opened in own browser, how to do it?


<a href="#" onclick="var w=window.open();w.document.write(document.getElementById('part_two').innerHTML);w.document.close();return false">Open #2 in new window</a>

This is a horribly crude way to make such a link, though. If the data must be opened in a new window, you always need to provide a fallback page (put that in href) and use unobtrusive JavaScript, so bind the click listener in your script and not like my example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜