惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Jina AI
Jina AI
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
M
MIT News - Artificial intelligence
S
SegmentFault 最新的问题
博客园 - 叶小钗
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
博客园_首页
U
Unit 42
月光博客
月光博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

博客园 - 琼

服务器 'server_1' 上的 MSDTC 不可用 - 琼 用javascript操作word文档 - 琼 - 博客园 Asp.Net中用javascript实现弹出窗口永远居中 - 琼 - 博客园 在sql server 2005数据库中更改数据架构 实现跟踪javascript代码进行调试 转摘--MS SQL Server 2000 数据库使用备份还原造成的孤立用户和对象名‘xxx’无效的错误的解决办法 转摘--具体影响Oracle系统性能的初始化参数 转摘--深入解读ADO.NET2.0的十大最新特性 实现关闭弹出页面后刷新父页 转摘——仿网易126网络硬盘上传 - 琼 - 博客园 转摘_修改表结构,让表中的字段按英文字母的顺序重新排列 javascript中获取文件后缀名 UltraWebGrid模板列及行的相关操作(转) JavaScript实现DataGrid中的CheckBox全选与否 实现弹出窗口的大小 解决"当前命令发生了严重错误。应放弃任何可能产生的结果。"的问题 设置页面文字大小及颜色 图片幻灯片显示 Windows 2000 CMD命令大全
用Javascript隐藏超级链接的真实地址
· 2007-11-16 · via 博客园 - 琼

用Javascript可以隐藏超级链接的真实地址:
在显示下载链接的页sample.aspx的前台合适地方加入以下代码如下:

<href="#" onclick="javascript:window.open('DownLoad.aspx?ID=11','newwin','width=350,height=510,scrollbars=0,toolbar=0,resizable=0')">打开窗口</a> 

通过DownLoad.aspx文件读取需下载的文件信息,在后台加入代码:

try
            
{
                
string str = "select FileContent,FileType, FileName from fileinfo where id = " + base.Request.QueryString["id"];
                SqlDataReader Dr 
= pubValue.DataRead(str);

                
string strfilePath = "file/" + base.User.Identity.Name;
                
string path = "";

                
if (Dr.Read())
                
{
                    
string s = Dr["FileName"].ToString();
                    path 
= base.Server.MapPath(strfilePath + "/" + s);

                    
if (File.Exists(path))
                    
{
                        File.Delete(path);
                    }


                    FileStream stream 
= new FileStream(path, FileMode.Create);
                    stream.Write((
byte[])Dr["FileContent"], 0, ((byte[])Dr["FileContent"]).Length);
                    StreamWriter writer 
= new StreamWriter(stream);
                    writer.WriteLine(
"");
                    writer.Flush();
                    writer.Close();
                    stream.Close();
                    
base.Response.Write("<script>location.href='" + strfilePath + "/" + base.Server.UrlEncode(s).Replace("+""%20"+ "';</script>");
                }

            }

            
catch (Exception exception)
            
{
                
base.Response.Write(exception.Message);
            }

当鼠标打向打开窗口时,出现的链接信息是#,而不是下载文件的链接地址,从而达到隐藏真实的超级链接地址的效果!