本文介绍了如何在Javacript中删除动态生成的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我必须替换字符串中的动态生成的html标签

我的字符串,如

Hi,

I have to replace dynamically generated html tag from string

my string like

str=''1 15/09/2011 15:00:1022/08/2011 13:41:00sdfssdfsdfsdfsdf45456.004 China <a href="frmEditDocument.aspx?perm=1&amp;action=edit&amp;ind=-1&amp;QID=8&amp;datasetId=1786&amp;visitorId=1" target="_blank">View/Edit Document100.00''



首先,所有文本都在javasript中的"str"字符串中.
现在我必须删除



above all text are in ''str'' string in javasript.
Now I have to remove

''<a href="frmEditDocument.aspx?perm=1&amp;amp;action=edit&amp;amp;ind=-1&amp;amp;QID=8&amp;amp;datasetId=1786&amp;amp;visitorId=1" target="_blank">''</a>



此tag.above标签是动态生成的,这意味着可能存在不同的数据集ID和不同的visitorID.

请帮助我如何删除此标记



this tag.above tag is dynamically generated means there may be different datasetID and different visitorID.

please help me how to remove this tag

推荐答案

protected override void Render(HtmlTextWriter writer)
    {//Occurs just before the page renders

      
            StringBuilder sb = new StringBuilder();
            using (StringWriter sw = new StringWriter(sb))
            {
                HtmlTextWriter hw = new HtmlTextWriter(sw);
                base.Render(hw);

            }
            string html = sb.ToString();
            html = html.Replace("My Regex String","");
        
            writer.Write(html);
    

    }


这篇关于如何在Javacript中删除动态生成的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 09:43