Hi!
Maybe you want to change the svg ctrl's size? A sample that's 
supposed to do this reads as follows:

<?xml version="1.0" encoding="UTF-8"?>
<?AdobeSVGViewer resolution="1200" save="snapshot"?>
<svg id="tstSVG" viewBox= "0 0 1000 1000" 
preserveAspectRatio= "xMidYMid meet" 
xmlns:xlink="http://www.w3.org/1999/xlink";>
        <script>
                try{
                        var oParentWin= (window.parent)?
(window.parent):(window.__parent__);
                        var oParentBody= oParentWin.document.body;
                        var oSVG= null;
                        var fZoom= 1.0;
                        function onResize(event){
                                try{
                                        if (!oSVG){
                                                window.focus();// 
make sure oSVG= oParentWin.document.activeElement
                                        
        oParentBody.style.overflow= "auto";
                                                setTimeout("oSVG= 
oParentWin.document.activeElement;onResize(null);", 250);
                                        }else{// 
((oSVG.tagName=="EMBED"))
                                                try{
                                                        if (!event)
                                                        
        return false;
                                                        switch
((event.type)?(event.type):("")){
                                                        
        case "mousewheel":
                                                                
        {
                                                                
                var actDefaultAntialias= window.getDefaultAntialias
();
                                                                
                if(actDefaultAntialias)
                                                                
                        setDefaultAntialias(false);
                                                                
                if(isNaN(fZoom))
                                                                
                        fZoom= 1.0;
                                                                
                var fInc= (event.wheelDelta >= 120)?(.1):(-.1);
                                                                
                fZoom= (fZoom>1)?(Math.floor(fZoom+fInc*10)):
(fZoom+fInc);
                                                                
                fZoom= Math.max(.1, Math.min(10., fZoom));
                                                                
                oSVG.style.zoom= fZoom;
                                                                
                oSVG.height= oParentBody.clientHeight;
                                                                
                oSVG.width=  oParentBody.clientWidth;
                                                                
                if(actDefaultAntialias)
                                                                
                        setTimeout("window.setDefaultAntialias
("+actDefaultAntialias+")", 1000);
                                                                
                oParentWin.status= "Zoom: " + oSVG.style.zoom;
                                                                
        }
                                                                
        break;
                                                        
        default:
                                                                
        {
                                                                
                oSVG.style.posHeight = oParentBody.clientHeight;
                                                                
                oSVG.style.posWidth= oParentBody.clientWidth;
                                                                
                oParentWin.status= ("Resized: [" + 
oParentBody.clientHeight + "x" + oParentBody.clientWidth + "]");
                                                                
        }
                                                        }//switch
(evt.type)
                                                }catch(e){alert
(e.description);}
                                        }
                                }catch(e){alert(e.description);}
                        }
                        {
                                oParentWin.attachEvent("onresize", 
onResize);
                                oParentWin.attachEvent
("onbeforeprint", onResize);
                                oParentWin.document.attachEvent
("onmousewheel", onResize);
                        };
                }catch(e){alert(e.description);}
        </script>
        <style type="text/css">
        <![CDATA[
        @media print {
        }
        ]]>
        </style>
        <g  style="fill:red; stroke:navy;">
                <circle cx="500" cy="500" r="100" 
style="fill:gold;"/>
                <path d="M0,495 l1000,0 l0,10 l-1000,0 z" />
                <path d="M495,0 l10,0 l0,1000 l-10,0 z" />
        </g>
</svg>




hth
Paul
NB: The sample was created for stand-allone svg printing 
tests/aspectratio bugfixes.. Ignore the zooming stuff.
 


--- In [email protected], "tamsvg" 
<[EMAIL PROTECTED]> wrote:
> 
> Hi!
> 
> I'm trying to set the width and the height from my svg tag with
> javascript by calling the onload event. But it doesn't work.
> 
> So what is wrong here:
> 
> 
> <svg id="svg" width="" height="" onload="init(evt)">
> 
> <script type="text/javascript">
>                       
>   function init(evt)
>   {
>     var elem = evt.target;
>     var svgdoc = elem.ownerDocument;
>     var svg = svgdoc.getElementsById('svg');
>     svg.setAttribute('width',window.innerWidth);
>     svg.setAttribute('height',window.innerHeight);
>   }
> 
> </script>
> 
> </svg>
> 
> I think that my variable svg is not ok, because I can't get the
> attributes of it. But how can I get the 'svg' element?
> 
> tam





-----
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