WEB exports or downloads the file function code in the modal form

  • 2020-06-12 08:48:06
  • OfStack

 
<title> My chats </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 ID="btn_Export" runat="server" Text=" export " OnClick="btn_Export_Click" OnClientClick="SetTarget()" /> 

Related articles: