读书人

VML失效有关问题

发布时间: 2011-12-28 22:45:21 作者: rapoo

VML失效问题。
我在asp.net后台代码里往页面的 <div id= "div1 "> </div> 里面写入下面的html,但是只显示了一部分的vml图象,很多都失效了。
div1.InnerHtml = " <v:group ID= 'group1 ' style= 'WIDTH:700px;HEIGHT:500px ' coordsize= '4900,3500 '> "
+ " <v:line from= '200,100 ' to= '200,2700 ' style= 'Z-INDEX:8;POSITION:absolute ' strokeweight= '1pt '> "
+ " <v:stroke StartArrow= 'classic '/> "
+ " </v:line> "
+ " <v:line from= '200,2700 ' to= '4500,2700 ' style= 'Z-INDEX:8;POSITION:absolute ' strokeweight= '1pt '> "
+ " <v:stroke EndArrow= 'classic '/> "
+ " </v:line> "
+ " <v:rect style= 'WIDTH:4600px;HEIGHT:2900px ' coordsize= '21600,21600 ' fillcolor= 'white ' strokecolor= 'black '> "
+ " <v:shadow on= 't ' type= 'single ' color= 'silver ' offset= '4pt,3pt '> </v:shadow> "
+ " </v:rect> "
+ " <v:shape style= 'position:absolute;left:50;top:2650;WIDTH:1000px;HEIGHT:200px;z-index:8 ' coordsize= '21600,21600 ' fillcolor= 'white '> "
+ " <v:textbox id= 'text1 ' inset= '3pt,0pt,3pt,0pt ' align= 'center ' style= 'font-size:10pt;v-text-anchor:bottom-center-baseline '> 0 </v:textbox> "
+ " </v:shape> "
+ " <v:line from= '200 2650 ' to= '4500 2650 ' style= 'position:absolute;z-index:8 '> "
+ " <v:stroke dashstyle= 'dot ' color= 'black '/> "
+ " </v:line> "
+ " <v:line from= '200 2550 ' to= '4500 2550 ' style= 'position:absolute;z-index:8 '> "
+ " <v:stroke color= '#c0c0c0 '> "
+ " </v:line> "
+ " <v:shape style= 'position:absolute;left:0;top:2500;WIDTH:1000px;HEIGHT:200px;z-index:8 ' coordsize= '21600,21600 ' fillcolor= 'white '> "
+ " <v:textbox id= 'tx1 ' inset= '3pt,0pt,3pt,0pt ' style= 'font-size:10pt;v-text-anchor:bottom-right-baseline '> 1 </v:textbox> "
+ " </v:shape> "
+ " <v:line from= '200 2450 ' to= '4500 2450 ' style= 'position:absolute;z-index:8 '> "
+ " <v:stroke dashstyle= 'dot ' color= 'black '/> "
+ " </v:line> "
+ " <v:line from= '200 2350 ' to= '4500 2350 ' style= 'position:absolute;z-index:8 '> "


+ " <v:stroke color= '#c0c0c0 '> "
+ " </v:line> "
+ " <v:shape style= 'position:absolute;left:0;top:2300;WIDTH:1000px;HEIGHT:200px;z-index:8 ' coordsize= '21600,21600 ' fillcolor= 'white '> "
+ " <v:textbox id= 'tx2 ' inset= '3pt,0pt,3pt,0pt ' style= 'font-size:10pt;v-text-anchor:bottom-right-baseline '> 2 </v:textbox> "
+ " </v:shape> "
+ " <v:line from= '200 2250 ' to= '4500 2250 ' style= 'position:absolute;z-index:8 '> "
+ " <v:stroke dashstyle= 'dot ' color= 'black '/> "
+ " </v:line> "
+ " <v:line from= '200 2150 ' to= '4500 2150 ' style= 'position:absolute;z-index:8 '> "
+ " <v:stroke color= '#c0c0c0 '> "
+ " </v:line> "
+ " <v:shape style= 'position:absolute;left:0;top:2100;WIDTH:1000px;HEIGHT:200px;z-index:8 ' coordsize= '21600,21600 ' fillcolor= 'white '> "
+ " <v:textbox id= 'tx3 ' inset= '3pt,0pt,3pt,0pt ' style= 'font-size:10pt;v-text-anchor:bottom-right-baseline '> 3 </v:textbox> "
+ " </v:shape> "
+ " <v:line from= '350 2700 ' to= '350 2750 ' style= 'position:absolute;z-index:8 '> "
+ " <v:stroke color= 'black '> "
+ " </v:line> "
+ " <v:shape style= 'position:absolute;left:300;top:2750;WIDTH:200px;HEIGHT:150px;z-index:8 ' coordsize= '21600,21600 ' fillcolor= 'white '> "
+ " <v:textbox id= 'ty1 ' inset= '3pt,0pt,3pt,0pt ' style= 'font-size:9pt;v-text-anchor:bottom-right-baseline '> 1 </v:textbox> "
+ " </v:shape> "
+ " <v:line from= '350 2700 ' to= '530 2750 ' style= 'position:absolute;z-index:8 '> "
+ " <v:stroke color= 'black '> "
+ " </v:line> "
+ " <v:shape style= 'position:absolute;left:480;top:2750;WIDTH:200px;HEIGHT:150px;z-index:8 ' coordsize= '21600,21600 ' fillcolor= 'white '> "
+ " <v:textbox id= 'ty2 ' inset= '3pt,0pt,3pt,0pt ' style= 'font-size:9pt;v-text-anchor:bottom-right-baseline '> 2 </v:textbox> "
+ " </v:shape> "
+ " <v:line from= '350 2700 ' to= '710 2750 ' style= 'position:absolute;z-index:8 '> "


+ " <v:stroke color= 'black '> "
+ " </v:line> "
+ " <v:shape style= 'position:absolute;left:660;top:2750;WIDTH:200px;HEIGHT:150px;z-index:8 ' coordsize= '21600,21600 ' fillcolor= 'white '> "
+ " <v:textbox id= 'ty3 ' inset= '3pt,0pt,3pt,0pt ' style= 'font-size:9pt;v-text-anchor:bottom-right-baseline '> 3 </v:textbox> "
+ " </v:shape> "
+ " <v:line from= '350 2700 ' to= '890 2750 ' style= 'position:absolute;z-index:8 '> "
+ " <v:stroke color= 'black '> "
+ " </v:line> "
+ " <v:shape style= 'position:absolute;left:840;top:2750;WIDTH:200px;HEIGHT:150px;z-index:8 ' coordsize= '21600,21600 ' fillcolor= 'white '> "
+ " <v:textbox id= 'ty4 ' inset= '3pt,0pt,3pt,0pt ' style= 'font-size:9pt;v-text-anchor:bottom-right-baseline '> 4 </v:textbox> "
+ " </v:shape> "
+ " <v:line from= '350 2700 ' to= '1070 2750 ' style= 'position:absolute;z-index:8 '> "
+ " <v:stroke color= 'black '> "
+ " </v:line> "
+ " <v:shape style= 'position:absolute;left:1020;top:2750;WIDTH:200px;HEIGHT:150px;z-index:8 ' coordsize= '21600,21600 ' fillcolor= 'white '> "
+ " <v:textbox id= 'ty5 ' inset= '3pt,0pt,3pt,0pt ' style= 'font-size:9pt;v-text-anchor:bottom-right-baseline '> 5 </v:textbox> "
+ " </v:shape> "
+ " </v:group> ";

[解决办法]
VML仅支持HTML 4.0文档类型,如果你使用的是Xhtml文档规范,就会出现大量不兼容情况。
将文档类型改为:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">

读书人网 >asp.net

热点推荐