Just curious, what's the use of setting width/height for the svg to window.innerXYZ? You can omit width and height for the svg and it will size to window.innerWidth and window.innerHeight since '100%' is the default value. It won't help for printouts either?
--- In [email protected], <[EMAIL PROTECTED]> wrote: > It is not so complicated as you tried to make it. > > <svg onload="init(evt)"> > > <script type="text/javascript"> > > function init(evt) > { > var elem = evt.target; > elem.setAttribute('width',window.innerWidth); > elem.setAttribute('height',window.innerHeight); > } > > </script> > > </svg> > > That will set the width/height of your SVG to the size of the browser > window, I think that is what you were trying to do. > > Regards, > Keir Gordon > > -----Original Message----- > From: tamsvg [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 12, 2005 4:09 AM > To: [email protected] > Subject: [svg-developers] set width and height from svg with javascript > > > > 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/

