This is one of the things which confused me in the very beginning. 
The <script> element in SVG is not exactly the same as the <script>
element in HTML.  It is not obvious how to include external scripts
from the spec:  http://www.w3.org/TR/SVG11/script.html#ScriptElement 
It's like the specification is intentionally confusing on this point.

You have to use the xlink:href attribute, not the src attribute. 
Furthermore, the xlink namespace needs to be defined up front on your
SVG element:

<svg version="1.1" ...
    onload="init();" 
    xmlns="http://www.w3.org/2000/svg"; 
    xmlns:xlink="http://www.w3.org/1999/xlink"; 
>
<script xlink:href="yourscript.js"/>
</svg>

Another option is to include the script in the body of the <script>
element (be sure to use CDATA block if you use characters like <, >, etc).

Also, if all your functionality is happening in the SVG file directly,
I advise you to do away with the referencing HTML document as it
serves no purpose.

Regards,
Jeff


--- In [email protected], "Pramod Eligeti."
<[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
>           i just have a simple doubt in SVG.
> 
> 
> 1. <body scroll="no">
>        <embed src="WorldView.svg" type="image/svg+xml" width="100%"
> height="100%        
>                            
> "pluginspage="http://www.adobe.com/svg/viewer/install/main.html";>
>        <div id="infoDiv"></div>
>  </body>
> -------------------------> here i am including the SVG "WorldView"
> document in the XHTML page.
> 
> 2. <script type="text/javascript"  language="javascript"
> src="ClientEventHandler.js"> </script>
>     <script type="text/javascript"  language="javascript"
> src="XMLHttpRequest.js"> </script>
> 
> ------------------> i have included these 2 java script files in the
> same XHTML page which have functions 
> 
> for Init n getTrueCoords defined in SVG document.
> 
> 
> 3. <svg xmlns="http://www.w3.org/2000/svg"; onload='Init(evt)'
> onmousemove='GetTrueCoords(evt); 
> 
> ShowTooltip(evt, true)'
>      onmouseout='ShowTooltip(evt, false)'>
> 
>  <g id='ToolTip' opacity='1.0' display='none' pointer-events='none'>
> 
>      <rect id='tipbox' x='0' y='5' width='100' height='20' rx='4'
> ry='4' fill='White' stroke='Black'/>
>      <text id='tipText' x='5' y='20' font-family='Times New Roman'
> font-size='13'>
>          <tspan id='tipTitle' x='5' font-weight='bold' fill='Blue'>
> </tspan>
>      </text>
> 
>  </g>
> 
> -------------> here is the code in "WordView" svg document.
> 
> 4. In the first JS file "ClientEventHandler.js" i have the funtions
> Init, GetTrueCoords(evt) ..... so on. 
> 
> now when a user preform some action like click an element say circle
> shape of SVG document, this JS script 
> 
> makes AJAX (XHR) requests n comes with an XML with some data, which i
> will parse n update the SVG document 
> 
> dynamically. Since this SVG is embedded in the HTML page, the page
> shows the necessary updated data.
> 
> Now my doubt is why to serve HTML page when user starts from the
> browser rather than the SVG document 
> 
> directly.
> 
> for that i need to include the 2 external javascript files in the SVG
> document so that i directly invoke 
> 
> the SVG document from the browser. i just tried to do like this but it
> doesnt work.
> 
> <svg xmlns="http://www.w3.org/2000/svg"; onload='Init(evt)'
> onmousemove='GetTrueCoords(evt); 
> 
> ShowTooltip(evt, true)'
>      onmouseout='ShowTooltip(evt, false)'>
> 
> <script type="text/javascript"  language="javascript"
> src="ClientEventHandler.js"> </script>
> <script type="text/javascript"  language="javascript"
> src="XMLHttpRequest.js"> </script>
> 
> <g id='ToolTip' opacity='1.0' display='none' pointer-events='none'>
> 
>      <rect id='tipbox' x='0' y='5' width='100' height='20' rx='4'
> ry='4' fill='White' stroke='Black'/>
>      <text id='tipText' x='5' y='20' font-family='Times New Roman'
> font-size='13'>
>          <tspan id='tipTitle' x='5' font-weight='bold' fill='Blue'>
> </tspan>
>      </text>
> 
>  </g>
> 
> </svg>
> 
> but here it says unable to find Init n other functions.
> 
> I also want suggestions that which is the good method to either embed
> SVG in HTML page or directly use SVG 
> 
> alone for web applications.
> 
> Tnks for suggestions n comments,
> 
> Byee,
> Pramod.
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~-> 

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to