coding SVG inline in an ASP.NET page causes the SVG javascript createSVGPoint(); function to break -


i require asp.net server side code in svg created. accomplish this, created .aspx file , inserted svg code this:

<%@ page language="c#" autoeventwireup="true" codebehind="mypage.aspx.cs" inherits="myapp.mypage" %>  <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="700px" height="700px" onload="initialize()">  <script type="text/ecmascript"> <![cdata[     script here      <% server code %>        ]]> </script>    <defs>     <style type="text/css">     <![cdata[          svg styles     ]]>     </style> </defs>     svg code         <% server code %> </svg> 

this works fine, can use <% %> , add server side logic svg. need use hidden fields information out of javascript.

as wrap code in html , add form etc; svg specific javascript break, namely createsvgpoint() function. svg still renders though...

does know work around, or better way add server side logic svg?

edit: updated example

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">  <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title>test</title>     <script type="text/ecmascript" language="ecmascript">     var root;     var svgroot;     var xmlns = "http://www.w3.org/2000/svg";      var mousepoint;     var transformedpoint;      function initialize() {         root = document;         svgroot = document.documentelement;         //alert("hello"); --works         mousepoint = svgroot.createsvgpoint();         transformedpoint = svgroot.createsvgpoint();         alert("hello"); -- broken                 }             </script> <style type="text/css">         .interactable     {         cursor:pointer;     } </style> </head> <body>     <form id="form1" runat="server">     <div>         <svg id="mysvg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"         width="700px" height="700px" onload="initialize()">                     <g id="workspace" transform="matrix(1, 0, 0, -1, 350, 350)">             </g>         </svg>     </div>     </form> </body> </html> 

also, have tried adding content types in pageload()

response.contenttype = "image/svg+xml"; response.contenttype = "application/xhtml+xml"; 

if svg wrapped in html page, might make more sense embed js in html instead of svg. give svg element id can access easily, , voila. scripting same.

i doubt usefulness of createsvgpoint though, you'd better own point prototype.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -