--- In svg-developers@yahoogroups.com, "gee_whiz_bang" <[EMAIL PROTECTED]> wrote: > > I need an example on how to use javascript to write a css style node, > if anyone has one. > I found a rather-too complex example the files. So I have simplified it down to this, and it works:
function svgAddTemplateObject(svgDoc, objNode) { var objDef = svgDoc.getElementById("def") if (objDef == null) { objDef = svgCreateNode(svgDoc, "def", "defs", null); svgDoc.documentElement.appendChild(objDef); } objDef.appendChild(objNode); } function svgCreateCSS(svgDoc, arrStyles) { var objStyle = svgCreateNode (svgDoc, "Styles", "style", "type:text/css"); var szCSSText = ".sText {font-size:30px;}"; for (szStyle in arrStyles) { szCSSText += "." + szStyle + " {" + arrStyles [szStyle] + "}"; } var objCDATA = svgDoc.createCDATASection(szCSSText); objStyle.appendChild(objCDATA); svgAddTemplateObject(svgDoc, objStyle); } ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/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/