以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 SVG/GML/VRML/X3D/XAML 』  (http://bbs.xml.org.cn/list.asp?boardid=21)
----  SVG里怎样嵌入ASP代码,我概念有问题?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=31634)


--  作者:PeterLee
--  发布时间:5/2/2006 2:06:00 AM

--  SVG里怎样嵌入ASP代码,我概念有问题?
我想实现一个很简单的功能,就是把数据库里的某些数据显示在SVG里,请问怎样显示?

我用下面的代码在IE里通过了,可是在FireFox里怎么也不行,只是显示文字,图片出不来。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>SVG</title>
</head>
<body>


<object type="image/svg+xml" data="svg.asp?.svg" width="300" height="200">
 <img src="NonSVG.gif" alt="SVG Image's Static Text" />
</object>


</body>
</html>

其中svg.asp文件内容如下:
<?xml version="1.0" standalone="no"?>

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<%
DBPath = "Peter Lee is a good boy!"
%>
<svg width="300" height="100" xmlns="http://www.w3.org/2000/svg">
    <rect x="25" y="10" width="280" height="50"
          fill="red" stroke="blue" stroke-width="3"/>
     <text x="20" y="50" font-size="20">
        <%=DBPath%>
     </text>
</svg>


--  作者:qq599730
--  发布时间:5/11/2006 3:04:00 PM

--  可以
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<svg onload="Create(evt,getDrawFontname())" id="mainview" xmlns="http://www.w3.org/2000/svg"

xmlns:xlink="http://www.w3.org/1999/xlink">
  <title>SVG - Learning By Coding</title>
  <defs>
    <script type="text/javascript">
      <![CDATA[
      function Create(evt,fontnameStr)
      {
        var svgdoc,svgroot,pi,df,en,et,ko,kr,cx,cy,ra,te,tx,ty,tc,tn,xmlser,output,
            svgns="http://www.w3.org/2000/svg";
        svgdoc=evt.target.ownerDocument;
        svgroot=svgdoc.rootElement;
      .......
 }

      ]]>
    </script>
<%
 if request("selfilter")="" or request("selfilter")="Drop_Shadow"  then
  response.write "<filter id=""Drop_Shadow"" filterUnits=""objectBoundingBox"" x=""-10%"" y=""-10%""

width=""150%"" height=""150%"">"
  response.write "<feGaussianBlur in=""SourceAlpha"" stdDeviation=""3"" result=""blurredAlpha""/>"
  response.write "<feOffset in=""blurredAlpha"" dx=""3"" dy=""3"" result=""offsetBlurredAlpha""/>"
  response.write "<feFlood result=""flooded"" style=""flood-color:rgb(99,7,7);flood-opacity:0.65""/> "
  response.write "<feComposite in=""flooded"" operator=""in"" in2=""offsetBlurredAlpha""

result=""coloredShadow""/> "
  response.write "<feComposite in=""SourceGraphic"" in2=""coloredShadow"" operator=""over""/> "
  response.write "</filter>"
 'else
  connstr="DBQ="+server.mappath("fontfilter.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
  set conn=server.createobject("ADODB.CONNECTION")
  conn.open connstr
  Set rs = CreateObject("adodb.recordset")
    'SQL = "select  * from filter where filtername=" & Request("selfilter")
    SQL = "select  * from filter "  
    rs.Open SQL, conn, 1, 3
    do while not (rs.eof or rs.bof)
    aa=rs("Mainfilter")
    response.write aa
        rs.moveNext
    loop
    rs.Close
    Set rs = Nothing
end if
%>
  </defs>
</svg>


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
31.250ms