如何使用锚标记打开文件 [英] How to open file using anchor tag

查看:60
本文介绍了如何使用锚标记打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做什么,我有一个动态表并创建行都可以正常工作的行.我试图在其中一个单元格中创建一个链接,单击该链接将打开一个文件.但是,当我单击链接时,它给我一个错误,提示无法在文件中找到服务器.然后,我要检查文件的方法是在地址栏中键入位置,找到它,但是将地址更改为(file:///c:/inetpub/wwwroot/test1.txt).因此,我所做的就是将该地址放入了定位标记,但仍然无法正常工作.到目前为止,这就是我所拥有的.任何帮助将不胜感激.

What im doing is I have a dynamic table and creating rows which all works fine. In one of the cells im trying to create a link which when clicked will open a file. But when I clicked the link it give me an error saying cannot find server at file. Then what I do to check the file is I type the location into the address bar and it finds it but changes the address to (file:///c:/inetpub/wwwroot/test1.txt). So what I did was put that address into the anchor tag but then its still doesnt work. Here is what I have so far. Any help would be very appreciated.

tblrow = New TableHeaderRow
tblcell = New TableHeaderCell
tblcell.Text = "<a href='C://inetpub/wwwroot/test1.txt' target='_blank'>" & Test &   "</a>"
 tblrow.Cells.Add(tblcell)
 tableName.Rows.Add(tblrow)

推荐答案

使用网址而不是物理路径.

Use a url and not a physical path.

更改

<a href='C://inetpub/wwwroot/test1.txt' target='_blank'>

通过绝对网址位置

<a href='http://DOMAIN/test1.txt' target='_blank'>

或相对网址位置(如果该文件位于您的网站上)

or a relative url location if the file is located on your site

<a href='RELATIVE_PATH/test1.txt' target='_blank'>

这篇关于如何使用锚标记打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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