移除网页的图片标签

某一些要求,移除网页的图片标签。
做个例子吧,在网页中,拉几个控件,其中一个是图片控件。

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RemoveImageTag.aspx.cs" Inherits="RemoveImageTag" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Text="this is a label"></asp:Label><br />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
        <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/p.gif" />
    </div>
    </form>
</body>
</html>
View Code


浏览并查看源代码:



现在,Insus.NET要做的,在网页运行,要自动移除网页所有<img ... />标签。
去.aspx.cs写一段代码:



这样子,就可以在runtime时,所有图片的标签移除,并可以做其它相关的动作了。运行看看:




posted @ 2013-07-04 17:28  Insus.NET  阅读(1790)  评论(0编辑  收藏  举报