0

首先看看这个小提琴http://jsfiddle.net/YrSzQ/

基本上我想做的是添加这样的代码

<a target="_blank" href="here should be the event tile that you see at the first line of the fiddleel .html">open event</a>

当我单击打开事件时,我应该在新页面中打开整个 div。

似乎我正在回答这个问题,但我无法访问小提琴中的代码,该代码是通过文件获取内容从远程页面检索的,我想在回显页面中的代码之前添加它

我希望你明白我要解释的内容

4

2 回答 2

0

Don't know if I understood you right, but if you want to open a new window with the content of a given div, why don't you just use window.open and add the content of the existing div to the opened window, as described here: Add content to a new open window

于 2013-05-30T15:33:56.900 回答
0

也许您正在寻找这样的东西?使用 jQuery 来识别您的 div 内的链接何时被单击,然后执行 javascript 操作以在其自己的窗口中打开该 div。

jsFiddle在这里

<html>
    <head>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
//alert('Document is ready');
                $('#newwindow a').click(function() {
                    alert('helloooooo');
                });

            });
        </script>
    </head>
<body>

<div id="newwindow">
    <span class="lshevent">Li - Mattek-Sands (Court 1)</span>       
    <div id="event153341" class="lshjpane-slider lshcontent" style="padding-top: 0px; border-top-width: medium; border-top-style: none; padding-bottom: 0px; border-bottom-width: medium; border-bottom-style: none; overflow: hidden; height: 308px;">
        <table width="100%" class="insideslidebg" cellpadding="0" cellspacing="0" border="0"><tbody><tr><td colspan="2"><b>Live Streaming Video </b> <span class="section">Tennis</span>
            <b>: </b> <span id="category754" class="category">Roland Garros 2013</span>
        </td>
    </tr></tbody></table></td>


{ SNIP! }


    </tr></tbody></table></div><!-- #event153341 -->

</div><!--#newwindow-->


</body>
</html>
于 2013-05-30T15:44:14.717 回答