首页 > 编程 > .NET > 正文

WEB在模态窗体里导出或下载文件功能代码

2024-07-10 13:16:16
字体:
来源:转载
供稿:网友

复制代码 代码如下:


<title>我的聊天记录</title>
<base target="_self" />
<script src="../JS/jquery-1.4.2.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$('a[href][href!="#"]').click(function() {
SetSelfTarget(this);
});
$('input').click(function() {
SetSelfTarget(this);
});
});
function SetTarget() {
var htmTarget = document.getElementsByTagName("head");
if ((undefined != htmTarget) && (0 < htmTarget.length)) {
var b = htmTarget[0].getElementsByTagName("base");
if ((undefined != b) && (0 < b.length)) {
b[0].target = "download";
}
}
}
function SetSelfTarget(obj) {
if (obj.id != "btn_Export") {
var htmTarget = document.getElementsByTagName("head");
if ((undefined != htmTarget) && (0 < htmTarget.length)) {
var b = htmTarget[0].getElementsByTagName("base");
if ((undefined != b) && (0 < b.length))
b[0].target = "_self";
}
}
}
</script>
<asp:Button runat="server" Text="导出" OnClientClick="SetTarget()" />

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表