首页 新闻 会员 周边 捐助

一个关于动态修改HTML字符串单引号的问题

0
悬赏园豆:20 [已解决问题] 解决于 2013-11-14 08:11

是这样的。我有一个需求.需要将一段HTML字符串中样式没有单引号 或者双引号的改成单引号.
比如其中有一个标签<table border=0></table>  这样的话我需要用代码改成<table border='0'></table>
因为如果不替换的 我后面的将HTML字符串转换为XML 会报错。需要动态处理 不能手动修改HTML字符串。

字符串中的字符不确定有多少个这样的需要添加或修改的标签.
本来开始打算用正则去匹配

不过老大说 让我用一个递归算法来实现  从<html> 开始 一层一层的递归去寻找替换或者修改。
思路我知道 但是实现上 我遇到点瓶颈  希望各位不吝赐教 谢谢!

何小宝的主页 何小宝 | 初学一级 | 园豆:19
提问于:2013-11-10 10:09
< >
分享
最佳答案
0

我喜欢用正则

我的思路跟 @_cha1R 一样,使用正则

我来说说怎么做(代码盲打,难免有误,重在思路):

var allHTML = ".....那些需要处理的html....";
var regExp = new Regex("(?<all>(?<key>\\w+?)=(?<value>[\'\"][^>\'\"]+[\'\"]))|(?<all>(?<key>\\w+?)=(?<value>[\'\"]?[^>\\s]+[\'\"]?))");

var matches = regExp.Matches(allHTML);

foreach(var m in matches)
{
    string temp = string.format("{0}='{1}'",m.Groups["key"].Value,m.Groups["value"].Value);    
    allHTML.replate(m.Groups["all"].Value, temp);
}
参考下图,如果懂正则应该不难理解。

袁家小黑球 | 小虾三级 |园豆:1045 | 2013-11-12 14:25

不好意思,急了一点,修正一下正则(没转义前):

(?<all>(?<key>\w+?)=['"](?<value>[^>'"]+)['"])|(?<all>(?<key>\w+?)=['"]?(?<value>[^>\s]+)['"]?)

上面中用到的正则不太完善。呵呵

 

 

袁家小黑球 | 园豆:1045 (小虾三级) | 2013-11-12 14:31
其他回答(6)
0

你是想用js加标点??

angelshelter | 园豆:9914 (大侠五级) | 2013-11-10 12:06

不是用JS 是C#

支持(0) 反对(0) 何小宝 | 园豆:19 (初学一级) | 2013-11-10 16:15
0

遍历字符,找到=号的,判断后一个字符是不是“和‘,如果不是,则将后一个单词加上‘

贪心狸猫 | 园豆:872 (小虾三级) | 2013-11-10 13:04
0

我赞成@贪心狸猫的做法,话说,这个需求,用递归合适吗?

幻天芒 | 园豆:37207 (高人七级) | 2013-11-10 13:16

老大就是这么说的  递归 比如从<html> 标签开始 一层一层的寻找。- - 没办法了

支持(0) 反对(0) 何小宝 | 园豆:19 (初学一级) | 2013-11-10 16:15

@何小宝: 那就慢慢递归了。这次有多了一个找下级的操作。

支持(0) 反对(0) 幻天芒 | 园豆:37207 (高人七级) | 2013-11-11 00:44

@幻天芒: 。。。我不会实现啊- -   这不是来发帖求助了么

支持(0) 反对(0) 何小宝 | 园豆:19 (初学一级) | 2013-11-11 08:26
0

linq 加递归.

平常心队长 | 园豆:1113 (小虾三级) | 2013-11-11 09:19

<html xmlns='http://www.w3.org/1999/xhtml' >

<head id='header1'><meta http-equiv='Content-Type' content='text/html; CHARSET=gb2312'></meta> <style type='text/css'>
body.printBody
{
background-color: #fff;
}

div.printFormToolBarContainer
{
width: 100%;
height: 26px;
}

div.printFormMiddleContainer
{
position: absolute;
left: 73px;
right: 73px;
top: 80px;
width: auto;
_position: static;
_width: 100%;
_height: 100%;
_padding: 54px 73px 0px 73px;
}

.printBody table.printTable
{
border-top:1px solid #000;
border-right:1px solid #000;
}

.printBody table.printTable td.printTdHeader
{
padding:3px;
font-weight:bolder;
background-color:#ddd;
border-left:1px solid #000;
border-bottom:1px solid #000;
}

.printBody table.printTable td.printTd
{
padding:3px;
border-left:1px solid #000;
border-bottom:1px solid #000;
}

@media Print
{
div.printFormToolBarContainer
{
display: none;
}

div.printFormMiddleContainer
{
position: static;
width: 100%;
_height: auto;
_padding: 0px 0px 0px 0px;
}
}

</style>
<style type='text/css'>body
{
font-size:9pt;
font-family: 宋体,Microsoft YaHei, Segoe UI, verdana, arial;
margin:0;
padding:0;
border:0;
background:#fff;
behavior:url(/sco/platform/public/scripts/commonBody.htc);

scrollbar-face-color: #dfdfdf !important;
scrollbar-track-color: #efefef !important;
scrollbar-arrow-color: #000000 !important;
scrollbar-3dlight-color: #ffffff !important;
scrollbar-darkshadow-color: #ffffff !important;
scrollbar-highlight-color: #767676 !important;
scrollbar-shadow-color: #767676 !important;
}
table,td
{
font-size:9pt;
font-family:宋体;
}
table.stdTable
{
width: 100%;
height: 100%;
table-layout: fixed;
}

.req
{
font-weight: bolder;
color: #9F2409;
overflow: hidden;
text-overflow: ellipsis;
padding-top: 5px;
}

.rec
{
font-weight: bolder;
color: #466094;
overflow: hidden;
text-overflow: ellipsis;
padding-top: 5px;
}

.n
{
padding-top: 5px;
overflow: hidden;
text-overflow: ellipsis;
}

.etLink
{
text-decoration:underline;
cursor:pointer;
overflow:hidden;
width:auto;
}

.urlLink
{
text-decoration:underline;
cursor:pointer;
}


/* Photo Border for All Pages Except the Albums Page */
.photo-frame
{
border-collapse:collapse;
}


.ScreenLog_State_Div
{
width:100%;
height:21px;
overflow:hidden;
background-color:#E0E3E8;
}
.ScreenLog_State_Table
{
width:100%;
height:100%;
font-size:12px;
FONT-FAMILY: SimSun-18030, Tahoma, Verdana, Arial;
BORDER-TOP: #a0a0a4 1px solid;
}
.ScreenLog_State_Table Td.Status
{
PADDING-LEFT: 8px;
}
.ScreenLog_Table Td.Page
{
COLOR:#666666;

TEXT-ALIGN: right;
}
.ScreenLog_Body_Div
{
width:Expression(document.body.offsetWidth-2);
height:100%;

overflow:auto;
background-color:#ffffff;
}
.ThumbText
{
height: 20px;
text-align : center;
}
.Thumb
{
text-align:center;
float:left;
margin-left:5px;
margin-top:5px;
BEHAVIOR: URL(/sco/platform/public/css/ThumbOver.htc);
}

div.errTitle
{
font-size: 18px;
color: #000099;
border-bottom: solid 1px #999999;
margin-bottom: 4px;
}

.disabledImg
{
-moz-opacity:0.5;
filter:gray() alpha(opacity=50);
}

/*MessageBox css begin*/
.MsgWinContainer{
background:#C1D2E7;
font-size:12px;
position:absolute;
}
.MsgWinContainer table
{
table-layout:fixed;
width:100%;
height:100%;
}
.MsgWinContainer .titleLeft
{
background:#C1D2E7 url('../../../Images/Message/win_lt.gif') no-repeat left top;
}
.MsgWinContainer .titleCenter
{
padding:3px,3px,0px,3px;
background:#C1D2E7 url('../../../Images/Message/win_t.gif') repeat-x left top;
}
.MsgWinContainer .titleCenter .titleText
{
line-height:25px;
font-size:12px;
color:#15428B;
font-weight:bold;
cursor:default;
padding-left:3px;
}
.MsgWinContainer .titleCenter .titleClose
{
overflow:hidden;
width:15px;
CURSOR: pointer;
display:inline;
background:#C1D2E7 url('../../../Images/Message/win_close.gif') no-repeat 0 3;
}
.MsgWinContainer .titleRight
{
background:#C1D2E7 url('../../../Images/Message/win_rt.gif') no-repeat right top;
padding:3px 3px 0px;
height:28px;
}


.MsgWinContainer .MsgContentTable
{
padding:0px;
MARGIN: 0px;
width:100%;
height:100%;
table-layout:auto;
}

.winMiddleLeft,.winBtnLineLeft{width:3px;font-size:3px;background:url('../../../Images/Message/win_l.gif') repeat-y;}
.winMiddleRight,.winBtnLineRight{width:3px;font-size:3px;background:url('../../../Images/Message/win_r.gif') right repeat-y;}
.winBottomCenter{height:3px;font-size:3px;background:url('../../../Images/Message/win_b.gif') repeat-x;}
.winBottomLeft{width:3px;font-size:3px;height:3px;background:url('../../../Images/Message/win_lb.gif') repeat-x;}
.winBottomRight{width:3px;font-size:3px;height:3px;background:url('../../../Images/Message/win_rb.gif') no-repeat;}

.MsgWinContainer .winMiddleCenter{
font-size:12px;
padding:10px 10px 0px 55px;
display:block;
word-break:break-all;
word-wrap:break-word;
/*white-space:nowrap;*/
vertical-align:middle;
height:4em;
background-repeat:no-repeat;
background-position:10px 10px;
background-color:#C7D6E9;
}
.MsgWinContainer .winMiddleCenterTextarea{
padding:5px 5px 1px;
}
.MsgWinContainer .winMiddleCenterTextarea TextArea
{
width:100%;
height:100%;
overflow:auto;
}
.MsgWinContainer .winBtnLineCenter input
{
margin-left:10px;
CURSOR: pointer;
background:url('../../../Images/Message/btn_bg.gif') no-repeat;
width:76px;
height:21px;
line-height:21px;
font-size:12px;
color:#000;
font-weight:normal;
border:0;
}
.MsgWinContainer .winMiddleCenter ol
{
list-style-position:inside;
margin:0;
}


.MsgWinContainer Div.Cover
{
background-color:#ffffff;
position:absolute;
overflow:hidden;
left:-2px;
top:-2px;
width:0px;
height:0px;
display:none;
}
/*MessageBox css end*/

.form
{
margin:0px;
padding:0px;
}

.scoWindow table,.scoWindow table table
{
table-layout:fixed;
}
.tl, .tr, .tc, .bl, .br, .bc
{
background-image: url(/Sco/Platform/Public/Images/Dialog/sprites.png);
background-repeat: no-repeat;
overflow:hidden;
font-size:0;
}
.scoWindow .tb_ie6
{
background-image: url(/Sco/Platform/Public/Images/Dialog/sprites.gif);
}

.ml, .mr
{
background-image: url(/Sco/Platform/Public/Images/Dialog/dialog.sides.png);
background-repeat: repeat-y;
overflow:hidden;

}
.scoWindow .m_ie6
{
background-image: url(/Sco/Platform/Public/Images/Dialog/dialog.sides.gif);
}


.tl
{
top: 0px;
left: 0px;
width: 2px;
height: 16px;
background-position: -30px -16px;
}
.tr
{
top: 0px;
right: 0px;
width: 16px;
height: 16px;
background-position: -16px -76px;
}
.tc
{
top: 0px;
right: 16px;
left: 16px;
height: 2px;
background-position: 0px -136px;
background-repeat: repeat-x;
}
.ml
{
top: 16px;
left: 0px;
width: 1px;
bottom: 51px;
background-position: -16px 0px;
background-image: url(/Sco/Platform/Public/Images/Dialog/dialog.sides.gif);
}
.mr
{
top: 16px;
right: 0px;
width: 16px;
bottom: 51px;
background-position: -16px 0px;
}
.bl
{
bottom: 0px;
left: 0px;
width: 16px;
height: 51px;
background-position: -30px -196px;
}
.br
{
bottom: 0px;
right: 0px;
width: 16px;
height: 51px;
background-position: -30px -263px;
}
.bc
{
bottom: 0px;
right: 30px;
left: 30px;
height: 21px;
background-position: 0px -360px;
background-repeat: repeat-x;
}

/*FormPage--Begin*/
.formBG
{
background-color:#F2F2F2;
}

DIV.formToolBarContainer
{
width: 100%;
height: 26px;
position: absolute;
z-index: 2;
}
DIV.formTopStatusContainer
{
width: 100%;
height: 30px;
position: absolute;
z-index: 2;
}
DIV.formMiddleContainer
{
width: 100%;
height: 100%;
z-index: 1;
}
DIV.formNavTreeContainer
{
width: 130px;
height: 100%;
float: left;
background: #ffffff;
border-right: 1px solid #466094;
overflow: auto;
margin-right: -3px;
}
DIV.formContentContainer
{
height: 100%;
overflow: auto;
margin: 0;
}
DIV.formBottomStatusContainer
{
width: 100%;
height: 27px;
position: absolute;
bottom: 0px;
z-index: 2;
}

TD.relatedInfoLabel
{
color:#466094;
}

TD.relatedInfoContent
{
word-break:break-all;
word-wrap:break-word;
white-space:normal;
}
/*FormPage--End*/


/*Toolbar begin*/
.appToolbar
{
color: #000;
background: url(../Images/Control/Toolbar/AppToolbarBG.jpg);
filter: progid:;
}

.listToolbar
{
color: #000;
border:1px solid #A9BFD6;
border-bottom:0px;
background: url(../Images/Control/Toolbar/AppToolbarBG.jpg);
filter: progid:;
}
.formToolbar
{
color: #000;
border-bottom:1px solid #a8aeb5;
background: url(../Images/Control/Toolbar/AppToolbarBG.jpg);
filter: progid:;
}

.formToolbarWithoutStatus
{
color: #000;
border-bottom:1px solid #466094;
background: url(../Images/Control/Toolbar/AppToolbarBG.jpg);
filter: progid:;
}
/*Toolbar end*/

/*ListGridView begin*/
.ListGridView_Div
{
position:relative;
border:1px solid #A9BFD6;
border-top:0px;
}

.ListGridView_Head_Div
{
width:100%;
height:29px;
overflow:hidden;
}

.ListGridView_FootStat_Table TD NOBR SPAN.amountResultNegative
{
color:red;
}

.ListGridView_FootStat_Table TD NOBR SPAN.amountResultPositive
{
color:green;
}

.ListGridView_FootStat_Table TD NOBR SPAN.amountResultZero
{
color:black;
}
/*ListGridView end*/

span.deleteConfirmRecordNumber
{
font-size:10pt;
font-weight:bolder;
display: inline;
color: Red;
}</style> <style type='text/css'>body
{
background-color:#FFFFFF;
margin:0;
padding:0;
border:0;
}

body.marginBody
{
padding:12px;
overflow:auto;
border:0;
margin:0;
}

#mainTB
{
background-color:#F2F2F2;
width:100%;
height:100%;
}

#listTD
{
}

 

td.filterTitle
{
font-weight:bolder;
padding-right:2px;
text-align:right;
}

input.defaultCheckBox
{
border:0;
}

.topStatus
{
background:#63769B;
border-top:1px solid #000000;
}

.topStatus td
{
font-size:11pt;
font-weight:bolder;
color:#ffffff;
}

.bottomStatus
{
background:#63769B;
}

.bottomStatus td
{

font-size:10pt;
font-weight:bolder;
color:#ffffff;
}
</style>
<style type='text/css'>input.input_text
{
line-height: 15px;
behavior: url(/sco/platform/public/webcontrol/input/input_text.htc);
}

TEXTAREA
{
font-size: 9pt;
width: 100%;
border: 1px solid #7b9ebd;
behavior: url(/sco/platform/public/webcontrol/textarea/textarea.htc);
}

INPUT
{
font-size: 9pt;
width: 100%;
height: 19px;
border: 1px solid #7b9ebd;
}

INPUT.readonly, TEXTAREA.readonly, DIV.readonly, SPAN.readonly, BUTTON.readonly
{
background-color: #ffffff !important;
color: #808080 !important;
border-color: #808080 !important;
}

INPUT.radio
{
width: 15px;
height: 20px;
border: 0px;
cursor: pointer;
vertical-align: middle;
}

Label.radLabel
{
margin-right: 10px;
}

DIV.radio
{
behavior: url(/sco/platform/public/webcontrol/input/input_radio.htc);
}

INPUT.eml
{
color: #0000ff;
text-decoration: underline;
behavior: url(/sco/platform/public/webcontrol/input/input_email.htc);
}

INPUT.chk
{
margin-top: 1px;
border: 0px;
width: 16px;
cursor: pointer;
behavior: url(/sco/platform/public/webcontrol/input/input_checkbox.htc);
}


INPUT.url
{
color: #0000ff;
text-decoration: underline;
behavior: url(/sco/platform/public/webcontrol/input/input_url.htc);
}

INPUT.num
{
behavior: url(/sco/platform/public/webcontrol/input/input_number.htc);
}

TABLE.dtm
{
behavior: url(/sco/platform/public/webcontrol/datetime/table_datetime.htc);
}

INPUT.hid
{
behavior: url(/sco/platform/public/webcontrol/input/input_hidden.htc);
}

INPUT.duration
{
behavior: url(/sco/platform/public/webcontrol/DatetimeDuration/dtDuration.htc);
}

SPAN.SelectItem
{
color: #0000ff;
text-decoration: none;
cursor: pointer;
font-size: 12px;
display: inline;
word-wrap: break-word;
}

SPAN.SelectItemNoAction
{
color: #000000;
text-decoration: none;
cursor: default;
font-size: 12px;
display: inline;
word-wrap: break-word;
}

IMG.SelectItem
{
height: 16px;
width: 16px;
vertical-align: text-bottom;
margin-left: 2px;
margin-right: 5px;
}

DIV.advancedSelect
{
overflow-y: auto;
word-wrap: break-word; /*height: 19px;*/
height: 100%;
background: window;
width: 100%;
border: 1px solid #7b9ebd;
}

TABLE.advancedSelect
{
behavior: url(/sco/platform/public/webcontrol/advancedSelect/table_advancedSelect.htc);
}

IMG.advancedSelect
{
cursor: pointer;
behavior: url(/sco/platform/public/webcontrol/advancedSelect/img_advancedSelect.htc);
}

IMG.dtm
{
cursor: pointer;
behavior: url(/Sco/Platform/Public/WebControl/Datetime/img_datetime.htc);
}

TD.radioLabel
{
padding-left: 2px;
padding-right: 10px;
}

TABLE.error
{
background-color: #ffffcc;
border: 1px solid #919276;
width: 100%;
table-layout: fixed;
padding-top: 20px;
padding-bottom: 20px;
}


/********************/
/* FORM css*/
/********************/
FORM.sco_form
{
margin: 0px;
behavior: url(/sco/platform/public/webcontrol/webform/webform.htc);
}

IMG.icon
{
margin-left: 2px;
margin-right: 5px;
}

TD.sec
{
width: 100%;
color: #000000;
font-weight: bolder;
padding-left: 0px;
padding-top: 1px;
padding-bottom: 2px;
text-overflow: ellipsis;
overflow: hidden;
}

.secTable TD.formCell
{
padding: 3px;
}

TD.bar
{
border-bottom: 1px solid #466094;
}

SPAN.shrinkExpandSpan
{
width: 16px;
height: 16px;
background: url(/sco/platform/public/webcontrol/images/ShrinkExpandBG.gif) no-repeat;
cursor: pointer;
}

TABLE.statusBar
{
color: #ffffff;
}

TD.statusBar
{
background-color: #63769B;
color: #ffffff;
padding-left: 5px;
height: 24px;
border-bottom: 1px solid #485673;
font-weight: bolder;
}

LABEL
{
cursor: pointer;
}

TD.leftBar
{
width: 100%;
text-align: right;
vertical-align: top;
background-color: #ffffff;
border-right: 4px solid #ffffff;
}

TABLE.error
{
background-color: #ffffcc;
border: 1px solid #919276;
table-layout: fixed;
}

TD.areas
{
padding: 10px;
}

DIV.area
{
overflow-x: auto;
width: 100%;
height: 100%;
}

TABLE.area
{
width: 100%;
height: 100%; /*border-left: 1px solid #466094;*/
}

TABLE.layout
{
table-layout: fixed;
width: 100%;
height: 100%;
}


/**tab*/
span.tab
{
font-size: 9pt;
border: 1px solid #6489D4;
top: 1px;
left: 1px;
height: 17px;
margin-right: 1px;
position: relative;
padding: 5px;
padding-top: 2px;
padding-bottom: 3px;
background-color: #ffffff;
cursor: pointer;
}

span.tabOn
{
filter: '';
background-color: #EEF0F6;
border-bottom: 1px solid #EEF0F6;
padding-bottom: 5px;
cursor: default;
}

hr.tabGlow
{
height: 3px;
color: #9EAA50;
border-top: 1px solid #7E9109;
border-bottom: 1px solid #B3C15B;
position: absolute;
z-index: 2;
display: none;
}

div.tab
{
width: 100%;
height: 100%;
border: 1px solid #6489D4;
background-color: #EEF0F6;
display: none;
overflow-y: auto;
padding: 10px;
}

DIV.area
{
overflow-x: auto;
width: 100%;
height: 100%;
}

table.tabBar
{
width: 100%;
height: 25px;
behavior: url(/sco/platform/public/webcontrol/tab/tabs.htc);
}


BUTTON.commonButton
{
border: 1px solid #7b9ebd;
cursor: pointer;
display: inline;
font-family: ????;
font-size: 12px;
overflow: hidden;
padding: 0px 5px;
padding-top: 2px;
text-align: center;
line-height:100%;
height:22px;
background: url(/Sco/Platform/Public/WebControl/Images/ButtonBG.gif) repeat-x 0 0;
}

BUTTON.commonButtonHover
{
border: 1px solid #7b9ebd;
cursor: pointer;
display: inline;
font-family: ????;
font-size: 12px;
overflow: hidden;
padding: 0px 5px;
padding-top: 2px;
text-align: center;
line-height:100%;
height:22px;
background: url(/Sco/Platform/Public/WebControl/Images/ButtonBG.gif) repeat-x 0 -19;
}

INPUT.chkoption
{
width: 16px;
height: 20px;
border: 0px;
cursor: pointer;
vertical-align: middle;
}

SPAN.chkoptionSpace
{
width: 8px;
}

DIV.chklist
{
behavior: url(/sco/platform/public/webcontrol/CheckBoxList/chklist.htc);
}

DIV.HtmlEdit
{
behavior: url(/sco/platform/public/webcontrol/HtmlEdit/HtmlEdit.htc);
}

DIV.ImageUpload
{
behavior: url(/sco/platform/public/webcontrol/ImageUpload/ImageUpload.htc);
}


/*????????*/
SPAN.TemplateTextBox
{
width: 100%;
height: 100%;
background-color: #ffffff;
color: #000000;
border: 1px solid #7B9EBD;
overflow: auto;
line-height: 16px;
behavior: url(/sco/platform/public/webcontrol/Template/TemplateTextBox.htc);
}
SPAN.ReplaceBlock
{
background-color: Yellow;
}

DIV.TemplateHtmlEditLayout
{
behavior: url(/sco/platform/public/webcontrol/Template/TemplateHtmlEditLayout.htc);
}
DIV.TemplateHtmlEdit
{
behavior: url(/sco/platform/public/webcontrol/Template/TemplateHtmlEdit.htc);
}

DIV.toolBar
{
border-left: solid 1px gray;
border-right: solid 1px gray;
border-top: solid 1px gray;
}

/*attachment control css begin*/
div.atm
{
width:100%;
height:100%;
border: 1px solid #7b9ebd;
padding: 5px;
behavior: url(/sco/platform/public/webcontrol/attachment/atm.htc);
overflow-y:auto;
overflow-x:hidden;
}

.atm .atmTopLine
{
border-bottom: 1px dotted #aaaaaa;
height:1px;
overflow:hidden;
}

.atm .atmAddLink span
{
height: 18px;
color: Blue;
text-decoration: underline;
cursor: pointer;
white-space: nowrap;
}

.atm .readonly
{
border: 1px solid #808080;
}

.atm .atmItem
{
width: 100%;
height: 23px;
font-size: 9pt;
font-family: ????;
white-space: nowrap;
border: 1px dotted #aaaaaa;
border-top: 0;
padding-left: 2px;
overflow:hidden;
}

.atmItemSelected
{
border:1px solid red;
background:#dddddd;
}

.atm .atmItem span
{
white-space: nowrap;
height: 20px;
margin-top: 5px;
cursor: pointer;
}

.atm .atmItem font
{
font-size: 9pt;
font-family: ????;
font-weight: bolder;
color: Blue;
margin-left: 5px;
margin-right: 2px;
}

.atm .atmItem img
{
height: 16px;
width: 16px;
border: 0;
vertical-align: middle;
}

.atm .atmItem .attDesc
{
margin-left:10px;
color: #565656;
font-size:9pt;
cursor:default;
}
/*attachment control css end*/

/*dayhourminute control css begin*/
.dayhourminute
{
behavior: url(/sco/platform/public/webcontrol/dayhourminute/dayhourminute.htc);
display: inline;
height: 20px;
}

.dayhourminute INPUT
{
display: inline;
ime-mode: disabled;
text-align: right;
font-family: Arial;
border-top: 0px;
border-left: 0px;
border-right: 0px;
background-color: transparent;
}

.dayhourminute INPUT.readonly
{
background-color: transparent !important;
color: #808080 !important;
border-color: #808080 !important;
}

.dayinput
{
width: 26px;
margin-right: 5px;
}

.hourinput
{
width: 20px;
margin-left: 5px;
margin-right: 5px;
}

.minuteinput
{
width: 20px;
margin-left: 5px;
margin-right: 5px;
}
/*dayhourminute control css end*/

/*ListSort control css begin*/
TABLE.ListSort
{
width: 100%;
height: 100%;
table-layout:fixed;
}

DIV.ListSort
{
width:100%;
height:100%;
overflow-y:auto;
overflow-x:hidden;
border: 1px solid #7b9ebd;
padding-bottom:25px;
behavior:url(/sco/platform/public/webcontrol/listsort/listsort.htc);
}

.listSortItem
{
width:100%;
height:25px;
/*line-height:25px;*/
padding-left:5px;
border-bottom: 1px solid #aaa;
white-space:nowrap;
overflow:hidden;
cursor:pointer;
padding-top:5px;
text-overflow:ellipsis;
behavior:url(/sco/platform/public/webcontrol/listsort/listSortItem.htc);
}

.listSortItem img
{
width:16px;
height:16px;
margin-right:3px;
}

.listSortItemSelected
{
background: #838DB1;
color: #fff;
}

.listSortItemHover
{
background: #61B1E0;
}
/*ListSort control css end*/

/*SelectBox control css begin*/
input.selectBox
{
width: 100%;
height: 19px;
border-right: 0px;
padding-left: 5px;
font-size: 9pt;
cursor: default;
}

span.selectBox
{
height: 21px;
behavior: url(/sco/platform/public/webcontrol/select/selectSimulation.htc);
}

SELECT.selectBox
{
width: 100%;
font-size: 9pt;
behavior: url(/sco/platform/public/webcontrol/select/select.htc);
}
span.editableSelect
{
height:21px;
behavior: url(/sco/platform/public/webcontrol/select/editableSelect.htc);
}
.cellLabel{width:90px;}
/*SelectBox control css end*/</style> <title>报价单: 核价eeeeeeeee</title> <title> </title><style type='text/css'>.sec_bar{
width: 100%;
color: #000000;
font-weight: bolder;
padding-left: 0px;
padding-top: 1px;
padding-bottom: 2px;
text-overflow: ellipsis;
overflow: hidden;

border-bottom: 1px solid #466094;
}

/**可编辑列表begin**/
.scoEditorGrid
{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
text-align:left;
border:1px solid #A9BFD6;
}
.scoEditorGridBorder
{
border:1px solid #A9BFD6;
}
.scoFormEditorGrid
{
behavior: url(/sco/platform/public/webcontrol/ScoEditorGrid/scoFormEditorGrid.htc);
}

/**可编辑列表自适应宽度和高度的样式 begin**/
.scoEditorGrid .x-grid-panel
{
height: 100%;
width: 100%;
overflow: hidden;
}
.scoEditorGrid .x-grid-panel .x-panel-bwrap
{
height: 100%;
width: 100%;
overflow: hidden;
}

.scoEditorGrid .x-grid-panel .x-panel-body
{
width: 100%;
height: 100%!important;
overflow: hidden;
}

.scoEditorGrid .x-grid3
{
height:100%;
width: 100%;
overflow:hidden;
}

.scoEditorGrid .x-grid3 .x-grid3-viewport
{
height: expression(Ext.get(parentNode.parentNode).getHeight())!important;
width: expression(Ext.get(parentNode.parentNode).getWidth())!important;
overflow:hidden;
}

.scoEditorGrid .x-grid3 .x-grid3-viewport .x-grid3-header
{
overflow:hidden;
width:100%;
padding-right:18px;
}

.scoEditorGrid .x-grid3 .x-grid3-viewport .x-grid3-scroller
{
height: expression(Ext.get(parentNode.parentNode).getHeight()-26)!important;
width: 100%;
overflow:auto!important;
}
/**可编辑列表自适应宽度和高度的样式 end**/
/**可编辑列表 end**/

</style>

</head> <body class='printBody'> <div class='printFormMiddleContainer'>
<table width='100%' height='100%' cellspacing='0' cellpadding='0'><tr><td valign='top'><div class='printTab'><table cellspacing='0' cellpadding='0' width='100%'><tr><td><table valign='top' cellspacing='0' cellpadding='0' border='0' width='100%'><tr><td><table valign='top' cellspacing='0' cellpadding='0' class='secTable' width='100%' height='1%' style='display:block;'><col/><col/><tr valign='top'><td class='formCell' colspan='2'><table cellpadding='0' cellspacing='0' border='0' style='width:100%;height:100%;'><col style='width:90px'/><col/><tr><td class='cellLabel' >名称:</td><td class='relatedInfoContent'>aaaaaa</td></tr></table></td></tr><tr valign='top'><td class='formCell'><table cellpadding='0' cellspacing='0' border='0' style='width:100%;height:100%;'><col style='width:90px'/><col/><tr><td class='cellLabel' >客户:</td><td class='relatedInfoContent'>Aaronrdg</td></tr></table></td><td class='formCell'><table cellpadding='0' cellspacing='0' border='0' style='width:100%;height:100%;'><col style='width:90px'/><col/><tr><td class='cellLabel' >报价人:</td><td class='relatedInfoContent'>檀庭</td></tr></table></td></tr><tr valign='top'><td class='formCell'><table cellpadding='0' cellspacing='0' border='0' style='width:100%;height:100%;'><col style='width:90px'/><col/><tr><td class='cellLabel' >报价时间:</td><td class='relatedInfoContent'>2013-10-29 16:41</td></tr></table></td><td class='formCell'><table cellpadding='0' cellspacing='0' border='0' style='width:100%;height:100%;'><col style='width:90px'/><col/><tr><td class='cellLabel' style='text-align:0;'></td><td class='relatedInfoContent'></td></tr></table></td></tr></table></td></tr></table></td></tr><tr><td><table valign='top' cellspacing='0' cellpadding='0' border='0' width='100%'><tr height='18'><td class='sec_bar'>商品清单</td></tr><tr height='5'><td></td></tr><tr><td><table valign='top' cellspacing='0' cellpadding='0' class='secTable' width='100%' height='100%' style='display:block;'><col width='50%'/><col width='50%'/><tr valign='top' height='100%'><td class='formCell' colspan='2'><table cellpadding='0' cellspacing='0' border='0' style='width:100%;height:115px;'><col/><tr><td class='relatedInfoContent' style='padding-bottom:3px;'><table class='printTable' border='0' cellspacing='0' cellpadding='3'><tr><td class='printTdHeader' width='125' align='left'>描述</td><td class='printTdHeader' width='125' align='left'>规格</td><td class='printTdHeader' width='50' align='left'>数量</td><td class='printTdHeader' width='75' align='left'>单价 (¥)</td><td class='printTdHeader' width='75' align='left'>小计 (¥)</td></tr><tr><td class='printTd' align='left'>成本测试</td><td class='printTd' align='left'>成本测试规格1</td><td class='printTd' align='left'>2.00</td><td class='printTd' align='left'>¥2,614.40</td><td class='printTd' align='left'>¥5,228.80</td></tr><tr><td class='printTd' align='left'>校园网站标准版</td><td class='printTd' align='left'></td><td class='printTd' align='left'>2.00</td><td class='printTd' align='left'>¥33.00</td><td class='printTd' align='left'>¥66.00</td></tr><tr><td class='printTd' align='left'>成本测试</td><td class='printTd' align='left'>成本测试规格2</td><td class='printTd' align='left'>1.00</td><td class='printTd' align='left'>¥3,300.00</td><td class='printTd' align='left'>¥3,300.00</td></tr><tr><td class='printTd' align='left'>参数5</td><td class='printTd' align='left'></td><td class='printTd' align='left'>1.00</td><td class='printTd' align='left'>¥1.00</td><td class='printTd' align='left'>¥1.00</td></tr><tr><td class='printTd' align='left'>参数8</td><td class='printTd' align='left'></td><td class='printTd' align='left'>1.00</td><td class='printTd' align='left'>¥2.00</td><td class='printTd' align='left'>¥2.00</td></tr><tr><td class='printTd' align='left'>参数9</td><td class='printTd' align='left'></td><td class='printTd' align='left'>1.00</td><td class='printTd' align='left'>¥4.00</td><td class='printTd' align='left'>¥4.00</td></tr><tr><td class='printTd' align='left'>总价</td><td class='printTd' align='left'></td><td class='printTd' align='left'>0.00</td><td class='printTd' align='left'>¥0.00</td><td class='printTd' align='left'>¥8,601.80</td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></div></td></tr></table></div></body></html> 这就是大概的字符串 希望前辈们贴出源码我参考下。谢谢

支持(0) 反对(0) 何小宝 | 园豆:19 (初学一级) | 2013-11-11 09:21

@何小宝: 前面的样式可以不管 后期要处理一下 直接从body标签开始递归

支持(0) 反对(0) 何小宝 | 园豆:19 (初学一级) | 2013-11-11 09:51
0

递归个毛毛呢,有什么递归的意义?直接正则匹配加判断。

林J | 园豆:202 (菜鸟二级) | 2013-11-11 13:26
0

不用递归。。。。

正则加判断,判断等于号前后的字符串

收获园豆:20
_cha1R | 园豆:403 (菜鸟二级) | 2013-11-11 16:05
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册