如何获得一个会话变量锚文本? [英] How to get anchor text in a Session variable?

查看:211
本文介绍了如何获得一个会话变量锚文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作中,我已经在主连接起来的PDF文件page.On单击锚标记中iframe.Now重定向到指定的页面,并显示PDF页面我希望文字锚要显示的项目其中,PDF被打开的页面上。
你看我有一个锚看起来像这样:

I am working on a project in which i have linked many pdf files in the master page.On clicking the anchor the page redirected to the specified page and displays pdf in iframe.Now i want the text in anchor tag to be displayed on the page where pdf is opened. Consider I have an anchor which looks like this :

<a href="<%= ResolveUrl("~") %>Main_Content.aspx?open=Departments/HR/NewsLetter/newsletter_dec_2014.pdf">News Letter</a>

现在我想要的文字新闻信重定向的页面上显示。
我想我可以这样通过保存文本会话variable.But我如何保存Session变量锚文本不指定任何ID或类锚标记?谁能帮我吗?

Now i want the text " News letter" to be shown on the redirected page. I think i could this by saving the text in session variable.But How can I save the anchor text in Session variable without specifying any id or class to the anchor tag? Can anyone help me please ?

推荐答案

您可以试试这个

$("a").click(function (e) {
if($(this).attr("href").match(".pdf$"))
{
    window.location.href = $(this).attr("href") + "&title=" + $(this).text();
    e.preventDefault();
}
});

在服务器端的Main_Content.aspx

On server side in "Main_Content.aspx"

strTitle = Request.QueryString["title"];

这篇关于如何获得一个会话变量锚文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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