在精美的盒子中打开PDF文件 [英] Open PDF file in fancy box

查看:87
本文介绍了在精美的盒子中打开PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在尝试使用按钮点击在fancyBox中打开PDF文件。按钮单击动态生成PDF文件路径。有没有办法做到这一点?

请帮帮我...



这是我现有的代码。

Hi All,

I'm trying to open PDF file in fancyBox using a Button click. PDF file path is generated dynamically on Button Click. Is there any way to do this ?
Please help me ...

This is my existing code.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery.fancybox.js" type="text/javascript"></script>
    <link href="Scripts/jquery.fancybox.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("a.fancyFrame").fancybox({
                'frameWidth': 200,
                'frameHeight': 200,
                'overlayShow': true,
                'hideOnContentClick': false,
                'type': 'iframe'
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div>
            <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
            <iframe src="Articles/HelloWorld.pdf" width="600" height="500"></iframe>
            <a id="myFrame" class="fancyFrame" title="Item Title" href="???">
                Link to Document</a>
        </div>
    </div>
    </form>
</body>
</html>



应该在Button Click代码后写什么?


And what should be written in Button Click code behind ?

protected void Button1_Click(object sender, EventArgs e)
        {
            string pdfPath=""; //the pdf file path is supplied here on runtime
        }





提前致谢...



Thanks in advance ...

推荐答案

document )。ready( function (){
(document).ready(function () {


a.fancyFrame)。fancybox({
' frameWidth' 200
' < span class =code-string> frameHeight': 200
' overlayShow' true
' hideOnContentClick' false
' type'' iframe'
});
});
< / script >
< / head >
< body >
< 表单 id = < span class =code-keyword> form1 runat = server >
< div >
< div >
< asp:按钮 ID = Button1 runat = 服务器 文字 = 按钮 onclick = Button1_Click / >
< iframe src = Articles / HelloWorld.pdf width = 600 height = 500 > < / iframe >
< a id = myFrame = fancyFrame title = 项目标题 href = < span class =code-keyword> ??? >
链接到文档 < / a >
< / div >
< / div >
< / form >
< / body >
< / html >
("a.fancyFrame").fancybox({ 'frameWidth': 200, 'frameHeight': 200, 'overlayShow': true, 'hideOnContentClick': false, 'type': 'iframe' }); }); </script> </head> <body> <form id="form1" runat="server"> <div> <div> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /> <iframe src="Articles/HelloWorld.pdf" width="600" height="500"></iframe> <a id="myFrame" class="fancyFrame" title="Item Title" href="???"> Link to Document</a> </div> </div> </form> </body> </html>



应该在Button Click代码后写什么?


And what should be written in Button Click code behind ?

protected void Button1_Click(object sender, EventArgs e)
        {
            string pdfPath=""; //the pdf file path is supplied here on runtime
        }





提前致谢...



Thanks in advance ...


这篇关于在精美的盒子中打开PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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