读书人

各位大侠:请帮忙把asp+vml的代码改

发布时间: 2012-02-28 13:06:36 作者: rapoo

各位大侠:请帮忙,把asp+vml的代码改成javascript调用的,谢谢!
源码如下:
<%
dim total(10,4)

total(1,1)= "项目 01 "
total(2,1)= "项目 02 "
total(3,1)= "项目 03 "
'total(2,1)=800
'total(3,1)=1000
'total(4,1)=600
'total(5,1)=1222
'total(6,1)=3213
'total(7,1)=8


total(1,2)=402003322.3
total(1,3)=300002222.3
total(1,4)=253237400


total(2,2)=35644333.22
total(2,3)=500004344.422
total(2,4)=280001000.5


total(3,2)=33003322.3
total(3,3)=300002222.3
total(3,4)=240000000





total_no=3
%>
<html xmlns:v= "urn:schemas-microsoft-com:vml " xmlns:o= "urn:schemas-microsoft-com:office:office ">
<!--[if !mso]>
<style>
v\:* { behavior: url(#default#VML) }
o\:* { behavior: url(#default#VML) }
.shape { behavior: url(#default#VML) }
</style>
<![endif]-->
<head>
<title> VMl三维图例 </title>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
</head>
<BODY bgColor=#ffffff leftMargin=5 topMargin=5 marginheight= "5 " marginwidth= "5 ">
<%call table1(total,total_no)%>
</body>
</html>


<%
function table1(total,total_no)
dim tb_color(7,3)
tb_color(1,1)= "#d1ffd1 "
tb_color(2,1)= "#ffbbbb "
tb_color(3,1)= "#d9d9e5 "
tb_color(4,1)= "#cff4f3 "
tb_color(5,1)= "#ffe3bb "
tb_color(6,1)= "#ffc7ab "
tb_color(7,1)= "#ecffb7 "


tb_color(1,2)= "#00ff00 "
tb_color(2,2)= "#ff0000 "
tb_color(3,2)= "#666699 "
tb_color(4,2)= "#33cccc "
tb_color(5,2)= "#ff9900 "
tb_color(6,2)= "#993300 "
tb_color(7,2)= "#99cc00 "


tb_color(2,3)= "计划成本 "
tb_color(3,3)= "发生成本 "
tb_color(4,3)= "实际支付 "


line_color= "#cccccc "
left_width=70
length=thickness/2
'total_no=ubound(total,1)


temp1=0
for i=1 to total_no
for j=2 to 4
if temp1 <total(i,j) then temp1=total(i,j)
next
next
temp1=round(cdbl(temp1),0)
'response.write " <script> alert( ' "&temp1& " '); </script> "
'response.end
'exit function


if temp1> 10 then
temp2=cdbl(left(temp1,1)+1)
do while (temp2 mod 2) <> 0
temp2=temp2+1
loop
temp3=temp2*10^(len(temp1)-1)
'response.write " <script> alert( ' "&temp1& " '); </script> "
'if temp2> 4 then
' temp3=(int(temp1/(10^(len(cstr(temp1))-1)))+1)*10^(len(cstr(temp1))-1)
'else
' temp3=(int(temp1/(10^(len(cstr(temp1))-1)))+0.5)*10^(len(cstr(temp1))-1)


'end if
else
if temp1> 5 then temp3=10 else temp3=5
end if
temp4=temp3/5


'response.write " <script> alert( ' "&temp1& "| "&temp2& "| "&temp4& " '); </script> "
'response.end
'exit function


%>
<div align= "center " style= "padding-top:10; ">
<v:group ID= "group2 " style= "WIDTH:700px;HEIGHT:500px " coordsize= "4900,3500 ">
<v:rect style= "WIDTH:4600px;HEIGHT:2900px " coordsize= "21600,21600 " style= "z-index:-3; " fillcolor= "white " strokecolor= "black ">
<v:shadow on= "t " type= "single " style= "z-index:-2; " color= "silver " offset= "4pt,3pt "> </v:shadow>
</v:rect>
<v:shape style= 'position:absolute;left:0px;top:80px;width:4600px;height:400px;text-align:center;z-index:3 '>
<div style= "font-size:18px; " > <b> 开发项目投资成本示例图 </b> </div>
</v:shape>
<v:line from= "500,500 " to= "500,2500 " style= "z-index:-1; " strokecolor= '#000000 ' strokeweight= "1pt "/>
<v:line from= "700,300 " to= "700,2300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,2500 " to= "3300,2500 " style= "z-index:-1; " strokecolor= '#000000 ' strokeweight= "1pt "/>
<v:line from= "700,2300 " to= "3500,2300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "3500,300 " to= "3500,2300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>

<v:line from= "500,2500 " to= "700,2300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,2100 " to= "700,1900 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,1700 " to= "700,1500 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,1300 " to= "700,1100 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,900 " to= "700,700 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,500 " to= "700,300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>



<v:group ID= "Title " style= "position:absolute;left:3600;top:300;WIDTH:900px;HEIGHT:900px " coordsize= "900,900 " >
<v:rect style= "WIDTH:800px;HEIGHT:700px " style= "z-index:-3; " fillcolor= "white " strokecolor= "black ">
</v:rect>

<%for j=2 to 4%>
<v:shape style= 'position:absolute;left:0px;top: <%=90+(j-2)*200%> px;width:900px;height:200px;z-index:-1 '>
<div style= "padding-left:5;font-size:12px; " title= " <%=tb_color(j,3)%> "> <%=tb_color(j,3)%> </div>
</v:shape>
<v:rect title= " <%=tb_color(j,3)%> " style= "left:100;top: <%=100+(j-2)*200%> ;WIDTH:100px;HEIGHT:100px " style= "z-index:1; " fillcolor= " <%=tb_color(j,2)%> " strokecolor= "black ">
<v:fill color2= ' <%=tb_color(j,1)%> ' rotate= 't ' type= 'gradient '/>
<o:extrusion v:ext= 'view ' backdepth= '10 ' color= ' <%=tb_color(j,2)%> ' on= 't '/>
</v:rect>
<%next%>

</v:group>

<%for i=1 to 5%>
<v:shape style= 'position:absolute;left:0px;top: <%=400*(6-i)%> px;width:500px;height:200px;z-index:-1 '>
<div align= 'right ' style= "font-size:11px;padding-right:5px; " title= " <%=round(temp4*i,2)%> "> <%=round(temp4*i,2)%> </div>
</v:shape>
<%next%>

<v:line from= "3500,2300 " to= "3300,2500 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>

<v:line from= "700,1900 " to= "3500,1900 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "700,1500 " to= "3500,1500 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "700,1100 " to= "3500,1100 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "700,700 " to= "3500,700 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "700,300 " to= "3500,300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>

<v:shape id= "boxbottom "
FillColor= "#999999 "
title= "基底 "


alt= "基底 "
Style= "position:relative;width:4900;height:3500;z-index:-2; "
path = "m
500,2500 l
700,2300,
3500,2300,
3300,2500,
500,2500,
x e "> </v:shape>
<v:shape id= "boxleft "
FillColor= "#eeeeee "
title= "背景墙 "
alt= "背景墙 "
Style= "position:relative;width:4900;height:3500;z-index:-2; "
path = "m
500,2500 l
700,2300,
3500,2300,
3500,300,
700,300,
500,500,
500,2500,
x e "> </v:shape>

<%for i=1 to total_no
templeft=500+200+200+(i-1)*600

%>

<v:shape style= 'position:absolute;left: <%=templeft%> px;top:2550px;width:430px;height:300px;z-index:-1 '>
<div align= 'left ' style= "font-size:12px; " title= " <%=total(i,1)%> "> <%=total(i,1)%> </div>
</v:shape>
<%for j=2 to 4
tempheight=round((total(i,j)/temp3)*2000,2)
temptop=400+2000-tempheight
%>
<v:rect id= '_x0000_s1025 ' alt= ' <%=tb_color(j,3)%> : <%=total(i,j)%> ' title= ' <%=tb_color(j,3)%> : <%=total(i,j)%> ' style= 'position:absolute;left: <%=templeft+(j-2)*135%> px;top: <%=temptop%> px;width:100px;height: <%=tempheight%> px;z-index:1 ' fillcolor= ' <%=tb_color(j,2)%> '>
<v:fill color2= ' <%=tb_color(j,1)%> ' rotate= 't ' type= 'gradient '/>
<o:extrusion v:ext= 'view ' backdepth= '10 ' color= ' <%=tb_color(j,2)%> ' on= 't '/>
</v:rect>
<%next%>
<%next%>

</v:group> </div>
<%
end function
%>


[解决办法]

<html xmlns:v= "urn:schemas-microsoft-com:vml " xmlns:o= "urn:schemas-microsoft-com:office:office ">
<style>
v\:* { behavior: url(#default#VML) }
o\:* { behavior: url(#default#VML) }
.shape { behavior: url(#default#VML) }
</style>
<head>
<title> VMl三维图例 </title>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
</head>
<BODY bgColor=#ffffff leftMargin=5 topMargin=5 marginheight= "5 " marginwidth= "5 ">
<div align= "center " style= "padding-top:10; ">
<v:group ID= "group2 " style= "WIDTH:700px;HEIGHT:500px " coordsize= "4900,3500 ">
<v:rect style= "WIDTH:4600px;HEIGHT:2900px " coordsize= "21600,21600 " style= "z-index:-3; " fillcolor= "white " strokecolor= "black ">


<v:shadow on= "t " type= "single " style= "z-index:-2; " color= "silver " offset= "4pt,3pt "> </v:shadow>
</v:rect>
<v:shape style= 'position:absolute;left:0px;top:80px;width:4600px;height:400px;text-align:center;z-index:3 '>
<div style= "font-size:18px; " > <b> 开发项目投资成本示例图 </b> </div>
</v:shape>
<v:line from= "500,500 " to= "500,2500 " style= "z-index:-1; " strokecolor= '#000000 ' strokeweight= "1pt "/>
<v:line from= "700,300 " to= "700,2300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,2500 " to= "3300,2500 " style= "z-index:-1; " strokecolor= '#000000 ' strokeweight= "1pt "/>
<v:line from= "700,2300 " to= "3500,2300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "3500,300 " to= "3500,2300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>

<v:line from= "500,2500 " to= "700,2300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,2100 " to= "700,1900 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,1700 " to= "700,1500 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,1300 " to= "700,1100 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,900 " to= "700,700 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "500,500 " to= "700,300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>

<v:group ID= "Title " style= "position:absolute;left:3600;top:300;WIDTH:900px;HEIGHT:900px " coordsize= "900,900 " >
<v:rect style= "WIDTH:800px;HEIGHT:700px " style= "z-index:-3; " fillcolor= "white " strokecolor= "black ">
</v:rect>


</v:group>


<v:line from= "3500,2300 " to= "3300,2500 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "700,1900 " to= "3500,1900 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "700,1500 " to= "3500,1500 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "700,1100 " to= "3500,1100 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "700,700 " to= "3500,700 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>
<v:line from= "700,300 " to= "3500,300 " style= "z-index:-1; " strokecolor= '#cccccc ' strokeweight= "1pt "/>

<v:shape id= "boxbottom "
FillColor= "#999999 "
title= "基底 "
alt= "基底 "


Style= "position:relative;width:4900;height:3500;z-index:-2; "
path = "m
500,2500 l
700,2300,
3500,2300,
3300,2500,
500,2500,
x e "> </v:shape>
<v:shape id= "boxleft "
FillColor= "#eeeeee "
title= "背景墙 "
alt= "背景墙 "
Style= "position:relative;width:4900;height:3500;z-index:-2; "
path = "m
500,2500 l
700,2300,
3500,2300,
3500,300,
700,300,
500,500,
500,2500,
x e "> </v:shape>

</v:group>
</div>
</body>
</html>


<script language= "vbscript " charset= "GB2312 ">

dim total(10,4)
total(1,1)= "项目 01 "
total(2,1)= "项目 02 "
total(3,1)= "项目 03 "
total(1,2)=402003322.3
total(1,3)=300002222.3
total(1,4)=253237400
total(2,2)=35644333.22
total(2,3)=500004344.422
total(2,4)=280001000.5
total(3,2)=33003322.3
total(3,3)=300002222.3
total(3,4)=240000000
totalno=3

dim tbcolor(7,3)
tbcolor(1,1) = "#d1ffd1 "
tbcolor(2,1) = "#ffbbbb "
tbcolor(3,1) = "#d9d9e5 "
tbcolor(4,1) = "#cff4f3 "
tbcolor(5,1) = "#ffe3bb "
tbcolor(6,1) = "#ffc7ab "
tbcolor(7,1) = "#ecffb7 "

tbcolor(1,2) = "#00ff00 "
tbcolor(2,2) = "#ff0000 "
tbcolor(3,2) = "#666699 "
tbcolor(4,2) = "#33cccc "
tbcolor(5,2) = "#ff9900 "
tbcolor(6,2) = "#993300 "
tbcolor(7,2) = "#99cc00 "

tbcolor(2,3) = "计划成本 "
tbcolor(3,3) = "发生成本 "
tbcolor(4,3) = "实际支付 "


linecolor = "#cccccc "
leftwidth = 70
ilength = thickness / 2

temp1 = 0
for i = 1 to totalno
for j = 2 to 4
if temp1 < total(i,j) then temp1 = total(i,j)
next
next
temp1 = round(cdbl(temp1),0)

if temp1 > 10 then
temp2 = CDbl(left(temp1,1) + 1)
temp2 = temp2 + (temp2 Mod 2)
temp3 = temp2 * 10 ^ (len(temp1) - 1)
else
if temp1 > 5 then
temp3 = 10
else
temp3 = 5
end if
end if
temp4 = temp3 / 5


tempstr = " "
set tempobj = document.getElementById( "Title ")
for j=2 to 4
tempstr = tempstr & " <v:shape style= 'position:absolute;left:0px;top: " & 90 + (j - 2) * 200 & "px;width:900px;height:200px;z-index:-1 '> "
tempstr = tempstr & " <div style= 'padding-left:5;font-size:12px; ' title= ' " & tbcolor(j,3) & " '> " & tbcolor(j,3) & " </div> "
tempstr = tempstr & " </v:shape> "
tempstr = tempstr & " <v:rect title= ' " & tbcolor(j,3) & " ' style= 'left:100;top: " & 100 + (j - 2) * 200 & ";WIDTH:100px;HEIGHT:100px;z-index:1;fillcolor= " & tbcolor(j,2) & " ' strokecolor= 'black '> "
tempstr = tempstr & " <v:fill color2= ' " & tbcolor(j,1) & " ' rotate= 't ' type= 'gradient '/> "
tempstr = tempstr & " <o:extrusion v:ext= 'view ' backdepth= '10 ' color= ' " & tbcolor(j,2) & " ' on= 't '/> "


tempstr = tempstr & " </v:rect> "
next
call tempobj.insertAdjacentHTML( "beforeEnd " , tempstr)

tempstr = " "
set tempobj = document.getElementById( "Title ")
for i = 1 to 5
tempstr = tempstr & " <v:shape style= 'position:absolute;left:0px;top: " & 400*(6-i) & "px;width:500px;height:200px;z-index:-1 '> "
tempstr = tempstr & " <div align= 'right ' style= 'font-size:11px;padding-right:5px; ' title= ' " & round(temp4*i,2) & " '> " & round(temp4*i,2) & " </div> "
tempstr = tempstr & " </v:shape> "
next
call tempobj.insertAdjacentHTML( "afterEnd " , tempstr)

tempstr = " "
set tempobj = document.getElementById( "group2 ")
for i = 1 to totalno
templeft=500+200+200+(i-1)*600

tempstr = tempstr & " <v:shape style= 'position:absolute;left: " & templeft & "px;top:2550px;width:430px;height:300px;z-index:-1 '> "
tempstr = tempstr & " <div align= 'left ' style= 'font-size:12px; ' title= ' " & total(i,1) & " '> "& total(i,1) & " </div> "
tempstr = tempstr & " </v:shape> "
for j = 2 to 4
tempheight = round((total(i,j) / temp3) * 2000,2)
temptop = 400 + 2000 - tempheight
tempstr = tempstr & " <v:rect id= '_x0000_s1025 ' alt= ' " & tbcolor(j,3) & " ': ' " & total(i,j) & " ' title= ' " & tbcolor(j,3) & ": " & total(i,j) & " ' style= 'position:absolute;left: " & templeft+(j-2)*135 & "px;top: " & temptop & "px;width:100px;height: " & tempheight & "px;z-index:1 ' fillcolor= ' " & tbcolor(j,2) & " '> "
tempstr = tempstr & " <v:fill color2= ' " & tbcolor(j,1) & " ' rotate= 't ' type= 'gradient '/> "
tempstr = tempstr & " <o:extrusion v:ext= 'view ' backdepth= '10 ' color= ' " & tbcolor(j,2) & " ' on= 't '/> "
tempstr = tempstr & " </v:rect> "
next
next
call tempobj.insertAdjacentHTML( "beforeEnd " , tempstr)

</script>

读书人网 >JavaScript

热点推荐