正则表达式获取HTML标记中的内容(C#)
正则表达式获取HTML标记中的内容(C#)
//=====================Begin1========================
//试验字符串
string strTmp = string.Empty;
//正则表达式
string tmpStr = string.Empty;
//取出指定HTML标记中的匹配项的值RegexOptions.IgnoreCase忽略大小写,RegexOptions.Multiline忽略多行显示,
//tmpStr = "<title>([^<]*)</title>" //获取<title>之间内容
strTmp = @"<add key='ConnectionString' value='server=localhost;database=数据库名;uid=sa;pwd=;pooling=true'/>";
//获取“database=”与“;”号之间的字符串:database=(.*);
tmpStr = "database=([^;]*);";
Match TitleMatch = Regex.Match(strTmp, tmpStr ,RegexOptions.IgnoreCase | RegexOptions.Multiline );
//如下例子作语法参考用获取size的值,实际应用可能不会如此复杂
strTmp = "><font color='red' size=6>WebForm3</font><" ;
tmpStr = @"<(w+s+w+[=]+[']+w+[']+s+[size=]+d)>";
Match TitleMatch = Regex.Match(strTmp ,tmpStr , RegexOptions.IgnoreCase | RegexOpt
相关文档:
原文地址:http://www.cnblogs.com/penny/archive/2008/09/01/1281293.html
看完此文请再看看<<提高你的DHTML性能>>
动态创建HTML内容除了用 document.write()和document.innerHTML()以外,还可以用DOM提供的方法:
createElement()和createTextNode()
1.先来说说DOM提供的createElement()和createTextNod ......
Html 标签中的Alt和Title
Alt和Title都是提示性语言标签,注意其区别。
在我们浏览网页时,当鼠标停留在图片对象或文字链接上时,在鼠标的右下角有时会出现一个提示信息框。对目标进行一定的注释说明。在一些场合,它的作用是很重要的。
alt 用来给图片来提示的。Title用来给链接文字或普通文字提示的。
用法如下:
......
HTML中object标签的详细用法 收藏
网页用的嵌入脚本,用来播放flash文件的,object是指对象的意思
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="780" height="160">
这句说明了所使用 ......
Frame框架现已不怎么常用,给个例子以展示其属性。
frame例子:
<frameset cols="50%,*">
<noframes>
<body>
Sorry,your explorer doesn't support the frame...
</body>
</noframes>
<frame name="left" src="left.html">
<frameset rows="*,30%">
<frame name=" ......